[wp-testers] Priorities of the categories

Andrew Nacin wp at andrewnacin.com
Wed Jun 20 14:17:36 UTC 2012


On Wed, Jun 20, 2012 at 9:19 AM, Sergey Biryukov <
sergeybiryukov.ru at gmail.com> wrote:

> On Wed, Jun 20, 2012 at 3:35 PM, Dispoweb2.0[Ghaith] <dispoweb at gmail.com>
> wrote:
> > It would be better if the CMS can offer the possibility to exclude a
> > category from being used on the URL structure or give it a low priority.
> > Something like this.
>
> There's a ticket for that: http://core.trac.wordpress.org/ticket/18752


Even without this filter, this is seriously easy to do.

For one project, Otto and I wrote a replacement for the categories metabox
that, next to the checkboxes, also included a column of radio buttons. You
could choose which category was the primary category for that post. We
would then store the selected primary category in postmeta. Then we would
filter on pre_post_link and replace %category% with the actual term name of
the primary category. There are other filters too, like post_link and
post_type_link.

This can require duplicating a few lines of core logic depending on your
goals, but point is, there's almost always a decent method to do something
even if there isn't a dead-obvious filter.

Nacin


More information about the wp-testers mailing list