404 to 301 icon
SEO

404 to 301 hooks reference

  • By Syed Balkhi
  • v4.0.5
  • Updated

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.

functions.phpyour child theme
// 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

  • app/Main/Front/Controller.php line 197
    /**
     * Filter the action chain for this request.
     */
    apply_filters( '404_to_301_actions', $actions, $request );
  • app/Admin/Assets.php line 195
    /**
     * Filter the localised script vars for an admin page.
     */
    apply_filters( '404_to_301_admin_script_vars', $vars, $entry );
  • app/Utils/Permission.php line 56
    /**
     * Filter the capability required to manage the plugin.
     */
    apply_filters( '404_to_301_capability', self::CAPABILITY );
  • app/Main/Front/Controller.php line 150
    /**
     * Fires on every 404 request, after every action has run.
     */
    do_action( '404_to_301_caught_404', $request );
  • app/Cli/Doctor.php line 118
    /**
     * Filter the grouped check list before rendering.
     */
    apply_filters( '404_to_301_doctor_checks', $groups );
  • app/Cli/Doctor.php line 166
    /**
     * 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 );
  • app/Main/Front/Actions/Email.php line 183
    /**
     * Filter the notification email recipient(s), subject and body.
     */
    apply_filters( '404_to_301_email_payload', [ 'recipient' => $recipients, 'subject' => $subject, 'body' => $body, ], $request );
  • app/Main/Reports/Reporter.php line 119
    /**
     * 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, ] );
  • app/Main/Reports/Reporter.php line 166
    /**
     * Fires after a report email has been queued through `wp_mail()`.
     */
    do_action( '404_to_301_email_reports_sent', $stats, $email );
  • app/Main/Reports/Stats.php line 144
    /**
     * Filter the number of top URLs included in the report body.
     */
    apply_filters( '404_to_301_email_reports_top_count', self::TOP_COUNT );
  • app/Main/Front/Actions/Email.php line 203
    /**
     * Fires after the notification email has been sent.
     */
    do_action( '404_to_301_email_sent', $email, $request );
  • app/Utils/Permission.php line 79
    /**
     * Filter the plugin access check.
     */
    apply_filters( '404_to_301_has_access', current_user_can( self::getCap() ) );
  • app/Main/Importer/Sources/Registry.php line 79
    /**
     * Filter the registered import sources.
     */
    apply_filters( '404_to_301_import_sources', $bundled );
  • app/Traits/Helpers/Urls.php line 259
    /**
     * Filters the human-vs-bot determination for a request.
     */
    apply_filters( '404_to_301_is_human', $isHuman, $userAgent );
  • app/Main/Cleaner/Cron.php line 371
    /**
     * Filter the background cron recurrence used by the polling (age / count)
     * prune modes.
     */
    apply_filters( '404_to_301_logs_cleaner_schedule', 'twicedaily' );
  • app/Main/Migration/Migrator.php line 682
    /**
     * Fires once the migration finishes successfully.
     */
    do_action( '404_to_301_migration_complete' );
  • app/Main/SlugMonitor.php line 132
    /**
     * Filter whether to auto-create a redirect for this slug change.
     */
    apply_filters( '404_to_301_monitor_slug_create', true, $postAfter, $postBefore );
  • app/Traits/Helpers/Urls.php line 63
    /**
     * Filters the normalized form of a URL before it is hashed or compared.
     */
    apply_filters( '404_to_301_normalize_url', $normalized, $raw );
  • app/Main/Front/Actions/Log.php line 142
    /**
     * Fires after a log row has been written.
     */
    do_action( '404_to_301_post_log_insert', $id, $data, $request );
  • app/Main/Front/Actions/Log.php line 111
    /**
     * Filter the log row data before it is written to the DB.
     */
    apply_filters( '404_to_301_pre_log_insert', $data, $request );
  • app/Main/Front/Actions/Redirect.php line 181
    /**
     * Fires immediately before the redirect headers are sent.
     */
    do_action( '404_to_301_pre_redirect', $url, $status, $request );
  • app/Main/Front/Actions/Redirect.php line 345
    /**
     * 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 );
  • app/Main/Front/Actions/Redirect.php line 280
    /**
     * Fires immediately before a terminal status header is sent.
     */
    do_action( '404_to_301_pre_terminal_status', $status, $request );
  • app/Models/Redirect.php line 933
    /**
     * Fires after a redirect row is created, updated or deleted.
     */
    do_action( '404_to_301_redirect_audit', $action, $id, $userId, $data );
  • app/Traits/Helpers/Redirects.php line 66
    /**
     * Filters the catalogue of supported HTTP status codes.
     */
    apply_filters( '404_to_301_redirect_statuses', $statuses );
  • app/Main/Front/Actions/Redirect.php line 156
    /**
     * Filter the resolved target URL and status code.
     */
    apply_filters( '404_to_301_redirect_target', [ 'url' => $target, 'status' => $status, ], $request );
  • app/Traits/Helpers/Redirects.php line 134
    /**
     * Filters the catalogue of global 404-fallback target modes.
     */
    apply_filters( '404_to_301_redirect_targets', $targets );
  • app/Main/Front/Controller.php line 140
    /**
     * Fires after every action in the chain has run (and the request hasn't been
     * redirected away).
     */
    do_action( '404_to_301_request', $request );
  • app/Main/Front/Request.php line 177
    /**
     * This filter is documented in {@see Request::method()}.
     */
    apply_filters( '404_to_301_request_host', $host, $this );
  • app/Main/Front/Request.php line 141
    /**
     * This filter is documented in {@see Request::method()}.
     */
    apply_filters( '404_to_301_request_ip', $ip, $this );
  • app/Main/Front/Request.php line 225
    /**
     * Filter the 404 check.
     */
    apply_filters( '404_to_301_request_is_404', is_404(), $this );
  • app/Main/Front/Request.php line 79
    /**
     * Filter the resolved request method.
     */
    apply_filters( '404_to_301_request_method', $method, $this );
  • app/Main/Front/Request.php line 95
    /**
     * This filter is documented in {@see Request::method()}.
     */
    apply_filters( '404_to_301_request_referer', $ref, $this );
  • app/Main/Front/Request.php line 157
    /**
     * This filter is documented in {@see Request::method()}.
     */
    apply_filters( '404_to_301_request_url', $url, $this );
  • app/Main/Front/Request.php line 111
    /**
     * This filter is documented in {@see Request::method()}.
     */
    apply_filters( '404_to_301_request_user_agent', $ua, $this );
  • app/Api/Endpoint.php line 75
    /**
     * Filter the per-request access check.
     */
    apply_filters( '404_to_301_rest_has_access', Permission::hasAccess(), $request );
  • app/Main/Front/Actions/Redirect.php line 362
    /**
     * Fires when the global 404 fallback should be rendered in place rather than
     * redirected.
     */
    do_action( '404_to_301_serve_404', $request, $type );
  • app/Api/Settings.php line 254
    /**
     * Filter the settings-export envelope before it's returned.
     */
    apply_filters( '404_to_301_settings_export', $envelope );
  • app/Api/Settings.php line 314
    /**
     * Filter the imported payload before it's merged.
     */
    apply_filters( '404_to_301_settings_import', $incoming, $body );
  • app/Main/Front/Controller.php line 122
    /**
     * Allow short-circuiting the whole pipeline.
     */
    apply_filters( '404_to_301_should_process', true, $request );
  • app/Main/Front/Actions/Redirect.php line 223
    /**
     * Whether to restrict redirects to the site's own host.
     */
    apply_filters( '404_to_301_use_safe_redirect', false, $url, $request );
  • app/Utils/ActionScheduler.php line 410
    /**
     * Filters whether to fall back to WP-Cron instead of Action Scheduler.
     */
    apply_filters( 'aioseo_use_cron_instead_of_action_scheduler', false, $this->actionSchedulerGroup );
  • app/Core/Assets.php line 605 · used in 3 places
    apply_filters( 'aioseo_404_to_301_normalize_assets_host', $paths[ $path ] );
  • app/Utils/ActionScheduler.php line 95
    apply_filters( 'action_scheduler_enable_recreate_data_store', true );
  • app/Options/Options.php line 128
    apply_filters( 'aioseo_404_to_301_get_options', $options );
  • app/Options/InternalOptions.php line 104
    apply_filters( 'aioseo_404_to_301_get_options_internal', $options );
  • app/Traits/Helpers/Wp.php line 116
    apply_filters( 'aioseo_404_to_301_public_post_types', $postTypes, $namesOnly, $hasArchivesOnly );
  • app/Traits/Helpers/Wp.php line 230
    apply_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: