WordPress.org

Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/query.php

    r36354 r35690  
    23012301            }
    23022302
    2303             $search_orderby = '';
     2303            $search_orderby = '(CASE ';
    23042304
    23052305            // sentence match in 'post_title'
     
    23222322                $search_orderby .= $wpdb->prepare( "WHEN $wpdb->posts.post_content LIKE %s THEN 4 ", $like );
    23232323            }
    2324 
    2325             if ( $search_orderby ) {
    2326                 $search_orderby = '(CASE ' . $search_orderby . 'ELSE 5 END)';
    2327             }
     2324            $search_orderby .= 'ELSE 5 END)';
    23282325        } else {
    23292326            // single word or sentence search
     
    49854982 * @global WP_Query   $wp_query   Global WP_Query instance.
    49864983 * @global wpdb       $wpdb       WordPress database abstraction object.
     4984 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
    49874985 */
    49884986function wp_old_slug_redirect() {
    4989     global $wp_query;
    4990 
    4991     if ( is_404() && '' !== $wp_query->query_vars['name'] ) :
     4987    global $wp_query, $wp_rewrite;
     4988
     4989    if ( '' !== $wp_query->query_vars['name'] ) :
    49924990        global $wpdb;
    49934991
     
    50315029        $link = get_permalink( $id );
    50325030
    5033         if ( isset( $GLOBALS['wp_query']->query_vars['paged'] ) && $GLOBALS['wp_query']->query_vars['paged'] > 1 ) {
     5031        if ( is_feed() ) {
     5032            $link = user_trailingslashit( trailingslashit( $link ) . 'feed' );
     5033        } elseif ( isset( $GLOBALS['wp_query']->query_vars['paged'] ) && $GLOBALS['wp_query']->query_vars['paged'] > 1 ) {
    50345034            $link = user_trailingslashit( trailingslashit( $link ) . 'page/' . $GLOBALS['wp_query']->query_vars['paged'] );
    50355035        } elseif( is_embed() ) {
    50365036            $link = user_trailingslashit( trailingslashit( $link ) . 'embed' );
     5037        } elseif ( is_404() ) {
     5038            // Add rewrite endpoints if necessary.
     5039            foreach ( $wp_rewrite->endpoints as $endpoint ) {
     5040                if ( $endpoint[2] && false !== get_query_var( $endpoint[2], false ) ) {
     5041                    $link = user_trailingslashit( trailingslashit( $link ) . $endpoint[1] );
     5042                }
     5043            }
    50375044        }
    50385045
Note: See TracChangeset for help on using the changeset viewer.