[wp-trac] [WordPress Trac] #18752: Allow category preference in permalinks

WordPress Trac wp-trac at lists.automattic.com
Thu Jun 21 17:46:52 UTC 2012


#18752: Allow category preference in permalinks
------------------------------+------------------
 Reporter:  aaroncampbell     |       Owner:
     Type:  enhancement       |      Status:  new
 Priority:  normal            |   Milestone:  3.5
Component:  General           |     Version:  3.2
 Severity:  normal            |  Resolution:
 Keywords:  has-patch commit  |
------------------------------+------------------

Comment (by aaroncampbell):

 [attachment:18752.5.diff] passes the return from the filter through
 get_term.  I'd been testing .4 and it worked great for me.  I re-ran all
 the tests with .5 passing back IDs instead and it worked well there too.
 I was testing with this:
 {{{
 function essence_post_link_category( $cat, $cats, $post ) {
         //return $cats[1];
         //return $cats[2];
         //return $cats[3];
         //return $cats[4];
         //return $cats[1]->term_id;
         //return $cats[2]->term_id;
         //return $cats[3]->term_id;
         return $cats[4]->term_id;
 }
 add_filter( 'post_link_category', 'essence_post_link_category', null, 3 );
 }}}

 I was testing with a post with 5 categories and the fifth had parents that
 were set properly as well.  I think it's ready to go in, but check it out
 and let me know what you think.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18752#comment:18>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list