Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (6 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

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

    r47018 r47122  
    999999function wp_old_slug_redirect() {
    10001000    if ( is_404() && '' !== get_query_var( 'name' ) ) {
    1001         // Guess the current post_type based on the query vars.
     1001        // Guess the current post type based on the query vars.
    10021002        if ( get_query_var( 'post_type' ) ) {
    10031003            $post_type = get_query_var( 'post_type' );
     
    10171017        }
    10181018
    1019         // Do not attempt redirect for hierarchical post types
     1019        // Do not attempt redirect for hierarchical post types.
    10201020        if ( is_post_type_hierarchical( $post_type ) ) {
    10211021            return;
     
    10621062        }
    10631063
    1064         wp_redirect( $link, 301 ); // Permanent redirect
     1064        wp_redirect( $link, 301 ); // Permanent redirect.
    10651065        exit;
    10661066    }
     
    10851085    $query = $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta, $wpdb->posts WHERE ID = post_id AND post_type = %s AND meta_key = '_wp_old_slug' AND meta_value = %s", $post_type, get_query_var( 'name' ) );
    10861086
    1087     // if year, monthnum, or day have been specified, make our query more precise
    1088     // just in case there are multiple identical _wp_old_slug values
     1087    // If year, monthnum, or day have been specified, make our query more precise
     1088    // just in case there are multiple identical _wp_old_slug values.
    10891089    if ( get_query_var( 'year' ) ) {
    10901090        $query .= $wpdb->prepare( ' AND YEAR(post_date) = %d', get_query_var( 'year' ) );
     
    11341134
    11351135        if ( ! $id ) {
    1136             // Check to see if an old slug matches the old date
     1136            // Check to see if an old slug matches the old date.
    11371137            $id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts, $wpdb->postmeta AS pm_slug, $wpdb->postmeta AS pm_date WHERE ID = pm_slug.post_id AND ID = pm_date.post_id AND post_type = %s AND pm_slug.meta_key = '_wp_old_slug' AND pm_slug.meta_value = %s AND pm_date.meta_key = '_wp_old_date'" . $date_query, $post_type, get_query_var( 'name' ) ) );
    11381138        }
Note: See TracChangeset for help on using the changeset viewer.