do_redirect_guess_404_permalink
Filter HookDescription
Filters whether to attempt to guess a redirect URL for a 404 request. Returning a false value from the filter will disable the URL guessing and return early without performing a redirect.Hook Information
File Location |
wp-includes/canonical.php
View on GitHub
|
Hook Type | Filter |
Line Number | 932 |
Hook Parameters
Type | Name | Description |
---|---|---|
bool
|
$do_redirect_guess
|
Whether to attempt to guess a redirect URL for a 404 request. Default true. |
Usage Examples
Basic Usage
<?php
// Hook into do_redirect_guess_404_permalink
add_filter('do_redirect_guess_404_permalink', 'my_custom_filter', 10, 1);
function my_custom_filter($do_redirect_guess) {
// Your custom filtering logic here
return $do_redirect_guess;
}
Source Code Context
wp-includes/canonical.php:932
- How this hook is used in WordPress core
<?php
927 * @since 5.5.0
928 *
929 * @param bool $do_redirect_guess Whether to attempt to guess a redirect URL
930 * for a 404 request. Default true.
931 */
932 if ( false === apply_filters( 'do_redirect_guess_404_permalink', true ) ) {
933 return false;
934 }
935
936 /**
937 * Short-circuits the redirect URL guessing for 404 requests.
PHP Documentation
<?php
/**
* Filters whether to attempt to guess a redirect URL for a 404 request.
*
* Returning a false value from the filter will disable the URL guessing
* and return early without performing a redirect.
*
* @since 5.5.0
*
* @param bool $do_redirect_guess Whether to attempt to guess a redirect URL
* for a 404 request. Default true.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-includes/canonical.php
Related Hooks
Related hooks will be displayed here in future updates.