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

WordPress Trac wp-trac at lists.automattic.com
Thu Sep 22 21:29:13 UTC 2011


#18752: Allow category preference in permalinks
---------------------------+------------------------------
 Reporter:  aaroncampbell  |       Owner:
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  General        |     Version:  3.2
 Severity:  normal         |  Resolution:
 Keywords:  has-patch      |
---------------------------+------------------------------

Comment (by aaroncampbell):

 The comment was already there, I just copy/pasted the line.  It's probably
 not a big deal to leave it there.

 I'm testing this patch on a site and it seems to be working exactly as
 expected.  I'm using this code to NOT use 'publications' as the category
 in the permalink if there are other options:
 {{{

 function da_remove_publications_cat( $cat ) {
         return ( 'publications' != $cat->slug );
 }
 function da_permalink_categories( $cats ) {
         if ( count( $cats ) > 1 )
                 $cats = array_filter( $cats, 'da_remove_publications_cat'
 );

         return $cats;
 }
 add_filter( 'post_link_categories', 'da_permalink_categories', 9 );
 }}}

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


More information about the wp-trac mailing list