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
906       *
907       * Returning a non-null value from the filter will effectively short-circuit
908       * the URL guessing, returning the passed value instead.
909       *
910       * @since 5.5.0
911       *
912       * @param null|string|false $pre Whether to short-circuit guessing the redirect for a 404.
913       *                               Default null to continue with the URL guessing.
914       */
915      $pre = apply_filters( 'pre_redirect_guess_404_permalink', null );
916      if ( null !== $pre ) {
917           return $pre;
918      }
919
920      if ( get_query_var( 'name' ) ) {
921           /**
922            * Filters whether to perform a strict guess for a 404 redirect.
923            *
924            * Returning a truthy value from the filter will redirect only exact post_name matches.