[wp-trac] [WordPress Trac] #16557: Ability to disable redirect_guess_404_permalink()

WordPress Trac noreply at wordpress.org
Sun Apr 3 20:45:53 UTC 2016


#16557: Ability to disable redirect_guess_404_permalink()
------------------------------------+-----------------------------
 Reporter:  msafi                   |       Owner:
     Type:  enhancement             |      Status:  new
 Priority:  normal                  |   Milestone:  Future Release
Component:  Canonical               |     Version:  3.1
 Severity:  minor                   |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:
------------------------------------+-----------------------------

Comment (by esemlabel):

 The if statement should contain exclusion of $_GET 'p' parametr for link
 rel='shortlink' to work properly.

 {{{
 function remove_redirect_guess_404_permalink( $redirect_url ) {
         if ( is_404() && !isset($_GET['p']) )
                 return false;
         return $redirect_url;
 }
 add_filter( 'redirect_canonical', 'remove_redirect_guess_404_permalink' );
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/16557#comment:28>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list