[wp-trac] [WordPress Trac] #36420: A more forgiving redirect guesser

WordPress Trac noreply at wordpress.org
Tue Apr 5 14:13:39 UTC 2016


#36420: A more forgiving redirect guesser
-------------------------+-----------------------------
 Reporter:  gorillum     |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Canonical    |    Version:
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 I would like the redirect guesser to be more forgiving using SOUNDS LIKE
 . Here's a small suggestion:




 {{{#!php
 function redirect_guess_404_permalink() {
         global $wpdb;

         if ( get_query_var('name') ) {
                 $where = $wpdb->prepare("(post_name SOUNDS LIKE %s",
 $wpdb->esc_like( get_query_var('name') ) );
                 $where .= $wpdb->prepare(" OR post_name LIKE %s)",
 $wpdb->esc_like( get_query_var('name') ) . '%');

 ....
 }}}

 It would be even better if it could be implemented using levenstein
 distance if that is not too heavy on resources.

 https://github.com/fza/mysql-doctrine-levenshtein-function

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36420>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list