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
864       *
865       * Returning a non-null value from the filter will effectively short-circuit
866       * the URL guessing, returning the passed value instead.
867       *
868       * @since 5.5.0
869       *
870       * @param null|string|false $pre Whether to short-circuit guessing the redirect for a 404.
871       *                               Default null to continue with the URL guessing.
872       */
873      $pre = apply_filters( 'pre_redirect_guess_404_permalink', null );
874      if ( null !== $pre ) {
875           return $pre;
876      }
877
878      if ( get_query_var( 'name' ) ) {
879           /**
880            * Filters whether to perform a strict guess for a 404 redirect.
881            *
882            * Returning a truthy value from the filter will redirect only exact post_name matches.