404 to 301 4.0.5 has 11 actions and 37 filters, read directly from its source code on Nov 17, 2026. The list updates automatically when a new version is released.
How to use these hooks
Actions let you run your own code at a specific moment. Filters let you change a value before the plugin uses it. Put your code in a child theme's functions.php or a code-snippets plugin, never in the plugin's own files, because updates overwrite them.
// Run your own code when 404 to 301 fires an action
add_action( '404_to_301_caught_404', function( $request ) {
// Your code runs here.
}, 10, 1 );
// Change a value 404 to 301 is about to use
add_filter( '404_to_301_actions', function( $actions, $request ) {
// Change $actions here.
return $actions;
}, 10, 2 );Parts of a name in {braces} are filled in at runtime (for example a post type or field ID). Choose Example on any hook for a ready-to-edit snippet.
All hooks
-
404_to_301_actions
filter/** * Filter the action chain for this request. */ apply_filters( '404_to_301_actions', $actions, $request ); -
404_to_301_admin_script_vars
filter/** * Filter the localised script vars for an admin page. */ apply_filters( '404_to_301_admin_script_vars', $vars, $entry ); -
404_to_301_capability
filter/** * Filter the capability required to manage the plugin. */ apply_filters( '404_to_301_capability', self::CAPABILITY ); -
404_to_301_caught_404
action/** * Fires on every 404 request, after every action has run. */ do_action( '404_to_301_caught_404', $request ); -
404_to_301_doctor_checks
filter/** * Filter the grouped check list before rendering. */ apply_filters( '404_to_301_doctor_checks', $groups ); -
/** * Filter the hook-name prefixes the doctor uses to identify plugin-owned cron * events. Addons that schedule jobs under a different prefix (eg. * `logs_cleaner_…`) can register it here so they show up in the doctor * output too. */ apply_filters( '404_to_301_doctor_cron_prefixes', $prefixes ); -
404_to_301_email_payload
filter/** * Filter the notification email recipient(s), subject and body. */ apply_filters( '404_to_301_email_payload', [ 'recipient' => $recipients, 'subject' => $subject, 'body' => $body, ], $request ); -
/** * Filter the report email payload immediately before dispatch. */ apply_filters( '404_to_301_email_reports_email', [ 'recipient' => $recipients, 'subject' => $subject, 'body' => $body, 'headers' => [ 'Content-Type: text/html; charset=UTF-8' ], 'attachments' => $attachments, ], $stats, [ 'frequency' => $frequency, 'last_sent_at' => $lastAt, ] ); -
/** * Fires after a report email has been queued through `wp_mail()`. */ do_action( '404_to_301_email_reports_sent', $stats, $email ); -
/** * Filter the number of top URLs included in the report body. */ apply_filters( '404_to_301_email_reports_top_count', self::TOP_COUNT ); -
404_to_301_email_sent
action/** * Fires after the notification email has been sent. */ do_action( '404_to_301_email_sent', $email, $request ); -
404_to_301_has_access
filter/** * Filter the plugin access check. */ apply_filters( '404_to_301_has_access', current_user_can( self::getCap() ) ); -
404_to_301_import_sources
filter/** * Filter the registered import sources. */ apply_filters( '404_to_301_import_sources', $bundled ); -
404_to_301_is_human
filter/** * Filters the human-vs-bot determination for a request. */ apply_filters( '404_to_301_is_human', $isHuman, $userAgent ); -
/** * Filter the background cron recurrence used by the polling (age / count) * prune modes. */ apply_filters( '404_to_301_logs_cleaner_schedule', 'twicedaily' ); -
/** * Fires once the migration finishes successfully. */ do_action( '404_to_301_migration_complete' ); -
/** * Filter whether to auto-create a redirect for this slug change. */ apply_filters( '404_to_301_monitor_slug_create', true, $postAfter, $postBefore ); -
404_to_301_normalize_url
filter/** * Filters the normalized form of a URL before it is hashed or compared. */ apply_filters( '404_to_301_normalize_url', $normalized, $raw ); -
404_to_301_post_log_insert
action/** * Fires after a log row has been written. */ do_action( '404_to_301_post_log_insert', $id, $data, $request ); -
404_to_301_pre_log_insert
filter/** * Filter the log row data before it is written to the DB. */ apply_filters( '404_to_301_pre_log_insert', $data, $request ); -
404_to_301_pre_redirect
action/** * Fires immediately before the redirect headers are sent. */ do_action( '404_to_301_pre_redirect', $url, $status, $request ); -
404_to_301_pre_serve_404
action/** * Fires immediately before a "serve in place" disposition is handed off — * the audit-trail twin of `404_to_301_pre_redirect` and * `404_to_301_pre_terminal_status`. */ do_action( '404_to_301_pre_serve_404', $request, $type ); -
/** * Fires immediately before a terminal status header is sent. */ do_action( '404_to_301_pre_terminal_status', $status, $request ); -
404_to_301_redirect_audit
action/** * Fires after a redirect row is created, updated or deleted. */ do_action( '404_to_301_redirect_audit', $action, $id, $userId, $data ); -
404_to_301_redirect_statuses
filter/** * Filters the catalogue of supported HTTP status codes. */ apply_filters( '404_to_301_redirect_statuses', $statuses ); -
404_to_301_redirect_target
filter/** * Filter the resolved target URL and status code. */ apply_filters( '404_to_301_redirect_target', [ 'url' => $target, 'status' => $status, ], $request ); -
404_to_301_redirect_targets
filter/** * Filters the catalogue of global 404-fallback target modes. */ apply_filters( '404_to_301_redirect_targets', $targets ); -
404_to_301_request
action/** * Fires after every action in the chain has run (and the request hasn't been * redirected away). */ do_action( '404_to_301_request', $request ); -
404_to_301_request_host
filter/** * This filter is documented in {@see Request::method()}. */ apply_filters( '404_to_301_request_host', $host, $this ); -
404_to_301_request_ip
filter/** * This filter is documented in {@see Request::method()}. */ apply_filters( '404_to_301_request_ip', $ip, $this ); -
404_to_301_request_is_404
filter/** * Filter the 404 check. */ apply_filters( '404_to_301_request_is_404', is_404(), $this ); -
404_to_301_request_method
filter/** * Filter the resolved request method. */ apply_filters( '404_to_301_request_method', $method, $this ); -
404_to_301_request_referer
filter/** * This filter is documented in {@see Request::method()}. */ apply_filters( '404_to_301_request_referer', $ref, $this ); -
404_to_301_request_url
filter/** * This filter is documented in {@see Request::method()}. */ apply_filters( '404_to_301_request_url', $url, $this ); -
/** * This filter is documented in {@see Request::method()}. */ apply_filters( '404_to_301_request_user_agent', $ua, $this ); -
404_to_301_rest_has_access
filter/** * Filter the per-request access check. */ apply_filters( '404_to_301_rest_has_access', Permission::hasAccess(), $request ); -
404_to_301_serve_404
action/** * Fires when the global 404 fallback should be rendered in place rather than * redirected. */ do_action( '404_to_301_serve_404', $request, $type ); -
404_to_301_settings_export
filter/** * Filter the settings-export envelope before it's returned. */ apply_filters( '404_to_301_settings_export', $envelope ); -
404_to_301_settings_import
filter/** * Filter the imported payload before it's merged. */ apply_filters( '404_to_301_settings_import', $incoming, $body ); -
404_to_301_should_process
filter/** * Allow short-circuiting the whole pipeline. */ apply_filters( '404_to_301_should_process', true, $request ); -
404_to_301_use_safe_redirect
filter/** * Whether to restrict redirects to the site's own host. */ apply_filters( '404_to_301_use_safe_redirect', false, $url, $request ); -
/** * Filters whether to fall back to WP-Cron instead of Action Scheduler. */ apply_filters( 'aioseo_use_cron_instead_of_action_scheduler', false, $this->actionSchedulerGroup ); -
apply_filters( 'aioseo_404_to_301_normalize_assets_host', $paths[ $path ] ); -
apply_filters( 'action_scheduler_enable_recreate_data_store', true ); -
apply_filters( 'aioseo_404_to_301_get_options', $options ); -
apply_filters( 'aioseo_404_to_301_get_options_internal', $options ); -
apply_filters( 'aioseo_404_to_301_public_post_types', $postTypes, $namesOnly, $hasArchivesOnly ); -
aioseo_is_rest_api_request
filterapply_filters( 'aioseo_is_rest_api_request', $isRestApiRequest );
Generated from 404 to 301's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.
Can't find the right hook?
We can build the customisation for you. Describe what you need: