Better Find and Replace icon
Backup & Migration

Better Find and Replace hooks reference

  • By CodeSolz
  • v2.0.1
  • Updated

Better Find and Replace 2.0.1 has 25 actions and 91 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 Better Find and Replace fires an action
add_action( 'bfr_code_insert_saved', function( $slot, $stored ) {
	// Your code runs here.
}, 10, 2 );

// Change a value Better Find and Replace is about to use
add_filter( 'bfr_redirect_validate', function( $errors, $arg2 ) {
	// Change $errors here.
	return $errors;
}, 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

  • core/Maintenance/Redirects/Validator.php line 260 · used in 2 places
    /**
     * Filter validation errors for a redirect.
     */
    apply_filters( 'bfr_redirect_validate', $errors, array( 'source' => $source_key, 'source_hash' => $source_hash, 'destination' => $destination, 'type' => $type, 'match_type' => 'exact', ) );
  • core/Maintenance/ReplaceRedirect/Variants.php line 65 · used in 2 places
    /**
     * This is not our filter - it belongs to DbReplacer, and we are asking it the
     * same question the engine will ask so the preview cannot disagree with the
     * apply.
     */
    apply_filters( 'bfrp_find_replace_variants', $variants, (string) $find, (string) $replace, array( 'encoded_urls' => (bool) $encoded, 'url_formats' => false, 'url_mode' => false, 'force_encoded' => false, ) );
  • core/Maintenance/Data/NotFoundRepository.php line 272
    /**
     * Filter the daily distinct-path budget for the 404 log.
     */
    apply_filters( 'bfr_404_daily_budget', $budget );
  • core/Maintenance/Data/NotFoundRepository.php line 294
    /**
     * Filter how many days 404 rows are kept.
     */
    apply_filters( 'bfr_404_retention_days', $days );
  • core/Maintenance/Admin/NotFoundTable.php line 145
    /**
     * Filter the row actions on a 404.
     */
    apply_filters( 'bfr_404_row_actions', $actions, $item );
  • core/Maintenance/NotFound/Capture.php line 109
    /**
     * Filter whether one 404 is recorded.
     */
    apply_filters( 'bfr_404_should_log', $should_log, $path, array( 'request' => $request, 'referrer' => self::referrer(), 'user_agent' => $user_agent, ) );
  • core/Maintenance/Duplicate/MetaPolicy.php line 130
    /**
     * Filter the meta keys a clone must not carry.
     */
    apply_filters( 'bfr_clone_denied_meta', $denied );
  • core/Maintenance/Duplicate/MetaPolicy.php line 167
    /**
     * Filter denials that depend on which keys the post actually has.
     */
    apply_filters( 'bfr_clone_denied_meta_for_post', $denied, array_keys( $meta ) );
  • core/Maintenance/Duplicate/Cloner.php line 140
    /**
     * Filter the post data a clone is created from.
     */
    apply_filters( 'bfr_clone_post_data', $row, $post );
  • core/Maintenance/Duplicate/Cloner.php line 233
    /**
     * Filter whether a post type may be duplicated.
     */
    apply_filters( 'bfr_clone_post_type', true, $type );
  • core/Maintenance/Duplicate/Cloner.php line 161
    /**
     * Filter the title a clone is given.
     */
    apply_filters( 'bfr_clone_title', $cloned, $post );
  • core/Maintenance/CodeInsert/Guard.php line 90
    /**
     * Filter whether the current user may save code snippets.
     */
    apply_filters( 'bfr_code_insert_can_edit', $can );
  • core/Maintenance/CodeInsert/Validator.php line 82
    /**
     * Filter the findings for one snippet.
     */
    apply_filters( 'bfr_code_insert_findings', $out, $content );
  • core/Maintenance/CodeInsert/Printer.php line 199
    /**
     * Filter one snippet immediately before it is printed.
     */
    apply_filters( 'bfr_code_insert_output', $content, $slot );
  • core/Maintenance/CodeInsert/Printer.php line 75
    /**
     * Filter the hook priority one slot prints at.
     */
    apply_filters( 'bfr_code_insert_priority', (int) $fallback, (string) $slot );
  • core/Maintenance/CodeInsert/Snippets.php line 157
    /**
     * Fires after a code snippet is stored.
     */
    do_action( 'bfr_code_insert_saved', $slot, $stored[ $slot ] );
  • core/Maintenance/CodeInsert/Printer.php line 159
    /**
     * Filter whether code snippets print on this request.
     */
    apply_filters( 'bfr_code_insert_should_run', true );
  • core/Maintenance/Admin/DashboardScreen.php line 517
    /**
     * Filter the dashboard cards.
     */
    apply_filters( 'bfr_dashboard_cards', $cards, $summary );
  • core/Maintenance/Admin/DashboardScreen.php line 214
    /**
     * Filter the Site Health tabs.
     */
    apply_filters( 'bfr_dashboard_screens', $tabs );
  • core/Maintenance/MediaHealth/Classifier.php line 94
    /**
     * Filter the issue type a grouped URL is recorded under.
     */
    apply_filters( 'bfr_issue_type_for_group', $type, $group );
  • core/Maintenance/Support/Entitlements.php line 167
    /**
     * Filter one entitlement answer.
     */
    apply_filters( 'bfr_maintenance_can', $default, $key, $known );
  • core/Maintenance/ReplaceRedirect/CacheFlush.php line 70
    /**
     * Fires after a Replace + Redirect, for caches this class cannot detect.
     */
    apply_filters( 'bfr_maintenance_flush_caches', $purged );
  • core/Maintenance/Data/Schema/Tables.php line 96
    /**
     * Fires after the maintenance tables are created or upgraded.
     */
    do_action( 'bfr_maintenance_installed', self::DB_VERSION );
  • core/Maintenance/Admin/IssuesTable.php line 254
    /**
     * Filter the row actions on an issue.
     */
    apply_filters( 'bfr_maintenance_issue_actions', $actions, $item );
  • core/Maintenance/Data/IssueRepository.php line 249
    /**
     * Fires when an issue is recorded for the first time.
     */
    do_action( 'bfr_maintenance_issue_created', $issue_key, $row );
  • core/Maintenance/Data/IssueRepository.php line 322
    /**
     * Fires when an issue is ignored.
     */
    do_action( 'bfr_maintenance_issue_ignored', $id );
  • core/Maintenance/Data/IssueRepository.php line 315
    /**
     * Fires when an issue is resolved.
     */
    do_action( 'bfr_maintenance_issue_resolved', $id );
  • core/Maintenance/Queue/Runner.php line 196
    /**
     * Register queue job handlers.
     */
    apply_filters( 'bfr_maintenance_job_handlers', array() );
  • core/Maintenance/Admin/IssuesTable.php line 396
    /**
     * Filter the controls shown above the issues list.
     */
    apply_filters( 'bfr_maintenance_list_actions', '', $this->type );
  • core/Maintenance/Queue/Runner.php line 215
    /**
     * Filter how many jobs one tick claims.
     */
    apply_filters( 'bfr_maintenance_queue_batch', $size );
  • core/Maintenance/Queue/Runner.php line 171
    /**
     * Filter the queue driver.
     */
    apply_filters( 'bfr_maintenance_queue_driver', $driver );
  • core/Maintenance/Queue/Runner.php line 269
    /**
     * Filter the gap between queue ticks, in seconds.
     */
    apply_filters( 'bfr_maintenance_queue_next_delay', $delay );
  • core/Maintenance/Queue/Runner.php line 238
    /**
     * Filter the per-tick time budget in seconds.
     */
    apply_filters( 'bfr_maintenance_queue_time_budget', $budget );
  • core/Maintenance/Data/ScanRunRepository.php line 236
    /**
     * Fires when a scan run completes.
     */
    do_action( 'bfr_maintenance_scan_completed', $id );
  • core/Maintenance/Data/ScanRunRepository.php line 243
    /**
     * Fires when a scan run fails.
     */
    do_action( 'bfr_maintenance_scan_failed', $id );
  • core/Maintenance/Data/ScanRunRepository.php line 124
    /**
     * Fires when a scan run opens.
     */
    do_action( 'bfr_maintenance_scan_started', $id, (string) $scan_type );
  • core/Maintenance/Admin/Screen.php line 435
    /**
     * Filter the Content Health tabs.
     */
    apply_filters( 'bfr_maintenance_screens', $tabs );
  • core/Maintenance/MediaHealth/Classifier.php line 196
    /**
     * Filter the extensions accepted as media.
     */
    apply_filters( 'bfr_media_extensions', array( 'jpg', 'jpeg', 'jpe', 'png', 'gif', 'webp', 'avif', 'svg', 'bmp', 'ico', 'tif', 'tiff', 'heic', 'mp4', 'm4v', 'mov', 'webm', 'ogv', 'avi', 'mpg', 'mpeg', 'wmv', 'flv', 'mp3', 'm4a', 'ogg', 'oga', 'wav', 'flac', 'aac', 'wma', 'pdf', ) );
  • core/Maintenance/MediaHealth/Classifier.php line 55
    /**
     * Filter which occurrence types count as media.
     */
    apply_filters( 'bfr_media_occurrence_types', $types );
  • core/Maintenance/Duplicate/Cloner.php line 94
    /**
     * Fires after a post has been cloned.
     */
    do_action( 'bfr_post_cloned', $new_id, (int) $post->ID, $meta['skipped'] );
  • core/Maintenance/Redirects/Executor.php line 107
    /**
     * Fires before a redirect is sent. Return false to cancel it.
     */
    apply_filters( 'bfr_redirect_before_execute', true, $match, $request );
  • core/Maintenance/Data/RedirectRepository.php line 356
    /**
     * Filter whether redirect hits are counted.
     */
    apply_filters( 'bfr_redirect_count_hits', true );
  • core/Maintenance/Data/RedirectRepository.php line 182
    /**
     * Fires after a redirect rule has been deleted.
     */
    do_action( 'bfr_redirect_deleted', (int) $id );
  • core/Maintenance/Redirects/Executor.php line 161
    /**
     * Fires after a redirect has been sent to the visitor.
     */
    do_action( 'bfr_redirect_executed', $match, $request );
  • core/Maintenance/Redirects/Executor.php line 94
    /**
     * Filter in a non-exact match.
     */
    apply_filters( 'bfr_redirect_match', null, $request );
  • core/Maintenance/Redirects/Validator.php line 110
    /**
     * Filter the available match types.
     */
    apply_filters( 'bfr_redirect_match_types', $types );
  • core/Maintenance/Admin/RedirectsTable.php line 124
    /**
     * Filter the row actions on a redirect.
     */
    apply_filters( 'bfr_redirect_row_actions', $actions, $item );
  • core/Maintenance/Admin/RedirectsScreen.php line 572
    /**
     * Filter the Redirects tabs.
     */
    apply_filters( 'bfr_redirect_screens', $tabs );
  • core/Maintenance/Redirects/Validator.php line 76
    /**
     * Filter the available redirect types.
     */
    apply_filters( 'bfr_redirect_types', self::free_types() );
  • core/Maintenance/Data/RedirectRepository.php line 408
    /**
     * Fires after any change to the redirect set.
     */
    do_action( 'bfr_redirects_changed', $count );
  • core/Maintenance/ReplaceRedirect/Workflow.php line 254
    /**
     * Fires when a Replace + Redirect finishes.
     */
    do_action( 'bfr_replace_redirect_after_apply', $result );
  • core/admin/functions/DbReplacer.php line 1183 · used in 2 places
    do_action( 'bfar_save_item_history', \json_encode( array( 'tbl' => $tbl, 'rid' => $row_id, 'pCol' => $primary_col, 'col' => $update_col, 'find' => $primary['find'], 'replace' => $primary['replace'], 'ici' => $isCaseInsensitive, 'old_val' => $original, 'new_val' => $current, ) ) );
  • core/Maintenance/Admin/DashboardScreen.php line 169
    apply_filters( 'bfr_dashboard_screen_content', '', $tab );
  • core/Maintenance/Admin/DashboardScreen.php line 164
    apply_filters( 'bfr_dashboard_screen_subtitle', '', $tab );
  • core/Maintenance/Admin/Screen.php line 265
    apply_filters( 'bfr_maintenance_screen_content', $content, $tab );
  • core/Maintenance/Admin/Screen.php line 253
    apply_filters( 'bfr_maintenance_screen_header_actions', $actions, $tab );
  • core/Maintenance/Admin/Screen.php line 258
    apply_filters( 'bfr_maintenance_screen_status', $status, $tab );
  • core/Maintenance/Admin/Screen.php line 271
    apply_filters( 'bfr_maintenance_screen_well', '', $tab );
  • core/Maintenance/Admin/LockedTab.php line 154
    apply_filters( 'bfr_maintenance_upgrade_url', self::UPGRADE_URL );
  • core/Maintenance/Admin/RedirectsScreen.php line 215
    apply_filters( 'bfr_redirect_screen_content', $content, $tab );
  • core/Maintenance/Admin/RedirectsScreen.php line 214
    apply_filters( 'bfr_redirect_screen_well', '', $tab );
  • core/admin/options/pages/AddNewRule.php line 265
    apply_filters( 'bfrp_active_skip_pages', FormBuilder::get_value( 'skip_pages', $option, '' ), $option );
  • core/admin/options/pages/AddNewRule.php line 281
    apply_filters( 'bfrp_active_skip_posts', FormBuilder::get_value( 'skip_posts', $option, '' ), $option );
  • core/admin/functions/DbReplacer.php line 296
    do_action( 'bfrp_after_db_replace', array( 'replaced' => $i, 'where' => $whereToReplace, 'builders' => $this->selected_builders, 'post_ids' => array_keys( $this->touched_post_ids ), 'settings' => $this->settings, ) );
  • core/admin/options/functions/AllMaskingRulesList.php line 45
    apply_filters( 'bfrp_all_masking_rules_tbl_rows', array( 'cb' => '<input type="checkbox" />', 'find' => __( 'Find', 'real-time-auto-find-and-replace' ), 'replace' => __( 'Replace by', 'real-time-auto-find-and-replace' ), 'type' => __( 'Rule Type', 'real-time-auto-find-and-replace' ), 'where_to_replace' => __( 'Where to replace', 'real-time-auto-find-and-replace' ), ) );
  • core/admin/functions/Masking.php line 110
    apply_filters( 'bfrp_before_insert_new_rule', $user_query );
  • core/lib/BuilderRegistry.php line 80
    apply_filters( 'bfrp_builder_registry', $map );
  • core/admin/options/functions/AllMaskingRulesList.php line 167
    do_action( 'bfrp_column_country_rules', $item );
  • core/admin/options/functions/AllMaskingRulesList.php line 92
    do_action( 'bfrp_column_find', $item );
  • core/admin/options/functions/AllMaskingRulesList.php line 175
    do_action( 'bfrp_column_lang_rules', $item );
  • core/admin/options/functions/AllMaskingRulesList.php line 151
    do_action( 'bfrp_column_skip_pages', $item );
  • core/admin/options/functions/AllMaskingRulesList.php line 159
    do_action( 'bfrp_column_skip_posts', $item );
  • core/admin/options/functions/AllMaskingRulesList.php line 137
    apply_filters( 'bfrp_column_type_text', $item );
  • core/admin/functions/DbReplacer.php line 231
    apply_filters( 'bfrp_custom_tables', $this->settings, $tables );
  • core/admin/options/functions/DbFuncReplaceInDb.php line 65
    apply_filters( 'bfrp_db_columns', array( 'all' => __( 'Select All', 'real-time-auto-find-and-replace' ), 'unselect_all' => __( 'Unselect All', 'real-time-auto-find-and-replace' ), 'post_title' => \ucwords( sprintf( __( '%s Title', 'real-time-auto-find-and-replace' ), $type ) ), 'post_content' => \ucwords( sprintf( __( '%s Content', 'real-time-auto-find-and-replace' ), $type ) ), 'post_excerpt' => \ucwords( sprintf( __( '%s Exce... );
  • core/admin/functions/DbReplacer.php line 308
    apply_filters( 'bfrp_dryrun_final_report', $dryRunReport );
  • core/admin/options/pages/AddNewRule.php line 85
    apply_filters( 'bfrp_filterSnAnrFields', $isShowScFields, $option, $ruleType );
  • core/admin/functions/DbReplacer.php line 1389
    apply_filters( 'bfrp_flush_object_cache', true );
  • core/admin/functions/DbReplacer.php line 1480
    apply_filters( 'bfrp_format_find_whole_word', $this->settings, $isCaseInsensitive, $find );
  • core/admin/functions/Masking.php line 233
    apply_filters( 'bfrp_get_rules_sql', array( 'where_to_replace' => $where_to_replace, 'where_id' => $where_id, 'ruleType' => $ruleType, ) );
  • core/admin/options/pages/AddNewRule.php line 180
    apply_filters( 'bfrp_masking_location_options', array( 'all' => __( 'All over the website', 'real-time-auto-find-and-replace' ), 'specificPagePost_disabled' => __( 'On specific page or post - pro version only', 'real-time-auto-find-and-replace' ), ) );
  • core/admin/options/pages/AddNewRule.php line 125
    apply_filters( 'bfrp_masking_rule_options', array( 'hasGroup' => array( __( 'Realtime Masking (no effect in Database)', 'real-time-auto-find-and-replace' ) => array( 'plain' => __( 'Plain Text', 'real-time-auto-find-and-replace' ), 'regex' => __( 'Regular Expression - Managed', 'real-time-auto-find-and-replace' ), 'regexCustom' => __( 'Regular Expression - Custom', 'real-time-auto-find-and-replace' ), 'ajaxContent' => __( 'jQuery / Ajax ... );
  • core/admin/options/pages/AddNewRule.php line 471
    apply_filters( 'bfrp_masking_settings_fields', $fields, $option );
  • core/admin/options/pages/MediaReplacer.php line 65
    apply_filters( 'bfrp_media_replacer_fields', $fields, $option );
  • bfrp_nav_caps

    filter
    core/lib/Util.php line 521
    apply_filters( 'bfrp_nav_caps', array( 'add_masking_rule' => 'bfar_menu_add_new_rule', 'all_masking_rules' => 'bfar_menu_all_replacement_rules', 'replace_in_db' => 'bfar_menu_replace_in_database', 'restore_in_db' => 'bfar_menu_restore_in_database', 'media_replacer' => 'bfar_menu_media_replacer', 'ai_settings' => 'bfar_menu_ai_settings', 'ai_content_refresher' => 'bfar_menu_ai_content_refresher', 'maintenance_dashboard' => 'bf... );
  • core/actions/RTAFAR_WP_Hooks.php line 128
    apply_filters( 'bfrp_render_real_time_rules', $item, $buffer );
  • core/admin/options/pages/ReplaceInDB.php line 218
    apply_filters( 'bfrp_replacedb_settings_fields', $fields, $option );
  • core/admin/functions/Masking.php line 132
    do_action( 'bfrp_save_masking_rule', $isExists, $user_query );
  • core/admin/options/functions/DbFuncReplaceInDb.php line 27
    apply_filters( 'bfrp_select_tables', array() );
  • core/admin/options/Scripts_Settings.php line 26
    apply_filters( 'bfrp_should_load_form_assets', false, $page_id, $rtafr_menu );
  • core/admin/options/Scripts_Settings.php line 85
    apply_filters( 'bfrp_should_load_page_assets', false, $page_id, $rtafr_menu );
  • core/admin/options/pages/AddNewRule.php line 267
    apply_filters( 'bfrp_skip_pages', FormBuilder::get_value( 'skip_pages', $option, '' ), $option );
  • core/admin/options/pages/AddNewRule.php line 268
    apply_filters( 'bfrp_skip_pages_desc_tip', __( 'Select pages where you don\'t want to apply this rule. e.g: Checkout, Home', 'real-time-auto-find-and-replace' ), $option );
  • core/admin/options/pages/AddNewRule.php line 257
    apply_filters( 'bfrp_skip_pages_title', sprintf( __( 'Skip Pages %1$s Pro version only %2$s', 'real-time-auto-find-and-replace' ), '<br/><span class="pro-version-only">', '</span>' ), $option );
  • core/admin/options/pages/AddNewRule.php line 283
    apply_filters( 'bfrp_skip_posts', FormBuilder::get_value( 'skip_posts', $option, '' ), $option );
  • core/admin/options/pages/AddNewRule.php line 284
    apply_filters( 'bfrp_skip_posts_desc_tip', __( 'Select posts where you don\'t want to apply this rule. Rules will be applied on single post pages only. e.g: My post', 'real-time-auto-find-and-replace' ), $option );
  • core/admin/options/pages/AddNewRule.php line 273
    apply_filters( 'bfrp_skip_posts_title', sprintf( __( 'Skip Posts %1$s Pro version only %2$s', 'real-time-auto-find-and-replace' ), '<br/><span class="pro-version-only">', '</span>' ), $option );
  • core/actions/RTAFAR_WP_Hooks.php line 116
    apply_filters( 'bfrp_skip_realtime_content_filter', false );
  • core/admin/functions/DbReplacer.php line 1011
    apply_filters( 'bfrp_url_replacer', $this->settings, $inWhichUrl );
  • core/admin/options/functions/DbFuncReplaceInDb.php line 39
    apply_filters( 'bfrp_url_types', array( 'all' => __( 'Select All', 'real-time-auto-find-and-replace' ), 'unselect_all' => __( 'Unselect All', 'real-time-auto-find-and-replace' ), 'post' => __( 'Post URLs', 'real-time-auto-find-and-replace' ), 'page' => __( 'Page URLs', 'real-time-auto-find-and-replace' ), 'attachment' => __( 'Media URLs (images, attachments etc..)', 'real-time-auto-find-and-replace' ), ) );
  • core/admin/options/functions/AllMaskingRulesList.php line 145
    apply_filters( 'bfrp_where_to_replace', $item );
  • core/admin/options/pages/ReplaceInDB.php line 83
    apply_filters( 'bfrp_where_to_replace_options', array( 'tables' => __( 'Database Tables', 'real-time-auto-find-and-replace' ), 'urls' => __( 'All URLs', 'real-time-auto-find-and-replace' ), 'page' => __( 'In All Pages', 'real-time-auto-find-and-replace' ), 'post' => __( 'In All Posts', 'real-time-auto-find-and-replace' ), ) );
  • core/Maintenance/ReplaceRedirect/CacheFlush.php line 176
    do_action( 'breeze_clear_all_cache' );
  • core/Maintenance/ReplaceRedirect/CacheFlush.php line 144
    do_action( 'litespeed_purge_all' );
  • core/admin/functions/ai/OAuth/Manager.php line 20
    apply_filters( 'rtafar_ai_oauth_flows', array( 'openrouter' => '\\RealTimeAutoFindReplace\\admin\\functions\\ai\\OAuth\\OpenRouterFlow', ) );
  • core/admin/functions/ai/ProviderRegistry.php line 306
    apply_filters( 'rtafar_ai_providers', self::all() );
  • core/admin/options/functions/AllMaskingRulesList.php line 203
    do_action( 'rtafar_allmaskingrules_extra_tablenav' );
  • core/actions/RTAFAR_CustomAjax.php line 111
    apply_filters( 'rtafar_allowed_methods', $this->allowed_methods() );
  • core/admin/options/Scripts_Settings.php line 25
    apply_filters( 'rtafar_menu_scripts', $rtafr_menu );
  • core/actions/RTAFAR_WP_Hooks.php line 226
    apply_filters( 'rtafar_row_meta', array( 'docs' => '<a target="_blank" href="' . esc_url( 'https://docs.codesolz.net/better-find-and-replace/' ) . '" aria-label="' . esc_attr__( 'documentation', 'real-time-auto-find-and-replace' ) . '">' . esc_html__( 'Docs', 'real-time-auto-find-and-replace' ) . '</a>', 'videos' => '<a target="_blank" href="' . esc_url( 'https://www.youtube.com/watch?v=nDv6T72sRfc&list=PLxLVEan0phTv5OfCX-FPu6n... );

Generated from Better Find and Replace'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: