categories – What’s the Simplest Way to Override/Rewrite the %category% Permalink Structure Tag?


By default, when someone sets their permalink structure to:


Post URLs appear like so:**abc**/some-cool-post/

ABC merely represents the first category of potentially several selected for the post, but unlikely the most appropriate.

I’ve made it so that my writers can select which category should be most prominent, which is saved as post meta for each post, and can be output with the variable $prominent_category.

I would like to automatically replace %category% with $prominent_category in the slug, without the need of registering an additional taxonomy or doing anything else that might be overkill, so that whatever the author sets as their prominent category, say Pizza, that the new structure for the post appears as so:**pizza**/some-cool-post/

Are either category_rewrite_rules or post_link_category the right choice, or should I be going down a different path?