Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: pre_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
900       *
901       * Returning a non-null value from the filter will effectively short-circuit
902       * the URL guessing, returning the passed value instead.
903       *
904       * @since 5.5.0
905       *
906       * @param null|string|false $pre Whether to short-circuit guessing the redirect for a 404.
907       *                               Default null to continue with the URL guessing.
908       */
909      $pre = apply_filters( 'pre_redirect_guess_404_permalink', null );
910      if ( null !== $pre ) {
911           return $pre;
912      }
913
914      if ( get_query_var( 'name' ) ) {
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.