Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: strict_redirect_guess_404_permalink

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
915           /**
916            * Filters whether to perform a strict guess for a 404 redirect.
917            *
918            * Returning a truthy value from the filter will redirect only exact post_name matches.
919            *
920            * @since 5.5.0
921            *
922            * @param bool $strict_guess Whether to perform a strict guess. Default false (loose guess).
923            */
924           $strict_guess = apply_filters( 'strict_redirect_guess_404_permalink', false );
925
926           if ( $strict_guess ) {
927                $where = $wpdb->prepare( 'post_name = %s', get_query_var( 'name' ) );
928           } else {
929                $where = $wpdb->prepare( 'post_name LIKE %s', $wpdb->esc_like( get_query_var( 'name' ) ) . '%' );
930           }
931
932           // If any of post_type, year, monthnum, or day are set, use them to refine the query.
933           if ( get_query_var( 'post_type' ) ) {