[wp-trac] Re: [WordPress Trac] #4652: Page and category trailing back-slash dependent on post permalink structure

WordPress Trac wp-trac at lists.automattic.com
Thu Jul 19 01:22:34 GMT 2007


#4652: Page and category trailing back-slash dependent on post permalink structure
------------------------+---------------------------------------------------
 Reporter:  snakefoot   |        Owner:  anonymous
     Type:  defect      |       Status:  new      
 Priority:  high        |    Milestone:  2.2.2    
Component:  General     |      Version:  2.2      
 Severity:  major       |   Resolution:           
 Keywords:  wp_rewrite  |  
------------------------+---------------------------------------------------
Comment (by snakefoot):

 Ofcourse I have to make an error in the plugin code :)
 {{{
 <?php
 function fix_trailing_backslash() {
   global $wp_rewrite;
   $wp_rewrite->use_trailing_slashes = true;
 }

 function fix_trailing_backslash_post( $link ) {
   global $wp_rewrite;
   if (!substr($wp_rewrite->permalink_structure, -1, 1) == '/' )
     return rtrim( $link, '/' );
   return $link;
 }

 add_action('init', 'fix_trailing_backslash');
 add_filter('post_link', 'fix_trailing_backslash_post' );
 ?>
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4652#comment:1>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list