OMGF 6.4.1 has 20 actions and 103 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 OMGF fires an action
add_action( 'omgf_update_settings', function( $updated_settings ) {
// Your code runs here.
}, 10, 1 );
// Change a value OMGF is about to use
add_filter( 'omgf_admin_stale_cache_options', function( $value ) {
// Change $value here.
return $value;
}, 10, 1 );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
-
/** * Filterable list of options that marks the cache as stale. */ apply_filters( 'omgf_admin_stale_cache_options', [ Settings::OMGF_ADV_SETTING_SUBSETS, ] ); -
/** * This is used for search/replace later on. This shouldn't be tampered with. */ apply_filters( 'omgf_frontend_process_fonts_set_href', $href['href'], $link ); -
/** * If required parameters aren't set, this request is most likely invalid. * Let's just remove it. */ apply_filters( 'omgf_frontend_process_invalid_request', ! isset( $query['family'] ), $href ); -
/** * $cache_key is used for caching. $handle contains the original handle. */ apply_filters( 'omgf_frontend_update_cache_key', false ); -
/** * Filter font_family name. */ apply_filters( 'omgf_generate_stylesheet_font_family', rawurldecode( $variant->fontFamily ) ); -
/** * Filter $variant to allow custom modifications of e.g., unicode-range, etc. */ apply_filters( 'omgf_generate_stylesheet_font_variant', $variant ); -
/** * This also captures the commented Subset name, but allows only one comment to * be captured to be more restrictive. */ apply_filters( 'omgf_optimize_parse_variants_regex', '/(?:\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\/\s*)?@font-face\s*\{[\s\S]*?\}/s', $this->url ); -
/** * Allow WP devs to use a different User-Agent, e.g. for compatibility with * older browsers/OSes. */ apply_filters( 'omgf_optimize_user_agent', self::USER_AGENT['woff2'] ); -
/** * Allows add-ons to remove results that don't apply to the current * configuration. */ apply_filters( 'omgf_performance_checker_results', OMGF::get_option( Settings::OMGF_DB_PERF_CHECK, [] ) ); -
/** * These options are always stored as (nested) arrays, keyed by the font * handle. A scalar value for any of them means the request was malformed, * e.g., a proxy or security plugin that flattened the array parameters * (foo[a][b]=x => foo=x). Persisting the scalar corrupts the option and, * because the read side subscripts it by handle, triggers a fatal "Cannot * access offset of type string on string" on ... */ apply_filters( 'omgf_settings_array_options', [ Settings::OMGF_OPTIMIZE_SETTING_PRELOAD_FONTS, Settings::OMGF_OPTIMIZE_SETTING_UNLOAD_FONTS, ] ); -
/** * If the stylesheet with $handle is completely marked for unloading, just * remove the element to prevent it from loading. */ apply_filters( 'omgf_unloaded_stylesheets', OMGF::unloaded_stylesheets() && in_array( $handle, OMGF::unloaded_stylesheets() ) ); -
/** * Additional update actions can be added here. */ do_action( 'omgf_update_settings', $updated_settings ); -
apply_filters( 'omgf_settings_page_title', 'OMGF' ); -
apply_filters( "{$name}_setting_description", $description ); -
apply_filters( "{$name}_setting_label", $label ); -
apply_filters( 'omgf_processed_html', $html, $this ); -
apply_filters( "{$name}_setting_disabled", $disabled ); -
apply_filters( "omgf_setting_{$name}", $value ); -
apply_filters( 'omgf_unused_stylesheet_threshold', OMGF::OMGF_UNUSED_STYLESHEET_THRESHOLD ); -
apply_filters( "{$name}_{$option}_setting_disabled", 'disabled' ); -
apply_filters( "{$name}_setting_options", $options ); -
do_action( "{str_replace('-','_',$field)}_content", '' ); -
apply_filters( 'apply_omgf_pro_promo', true ); -
do_action( 'flying_press_purge_all' ); -
do_action( 'litespeed_purge_all' ); -
apply_filters( 'omgf_admin_optimize_verify_ssl', str_contains( get_home_url(), 'https:' ) ); -
apply_filters( 'omgf_admin_settings_active_tab', self::OMGF_SETTINGS_FIELD_OPTIMIZE ); -
do_action( 'omgf_after_clean_up' ); -
do_action( 'omgf_after_settings_form_settings' ); -
apply_filters( 'omgf_ajax_admin_bar_status', $status ); -
apply_filters( 'omgf_ajax_results', $urls, $params, $path ); -
apply_filters( 'omgf_api_dashboard_permission', $is_allowed ); -
do_action( 'omgf_before_settings_form_settings' ); -
apply_filters( 'omgf_buffer_output', $html ); -
do_action( 'omgf_cache_files_deleted' ); -
apply_filters( 'omgf_cache_key', $cache_key, $handle ); -
apply_filters( 'omgf_cache_keys', self::$cache_keys ); -
apply_filters( 'omgf_clean_up_instructions', [ 'init' => $initiator, 'exclude' => [], 'queue' => $flush_rows, ] ); -
do_action( 'omgf_dashboard_after_success_message' ); -
apply_filters( 'omgf_dashboard_intro', __( 'OMGF (Optimize My Google Fonts) automatically replaces Google Fonts stylesheets (e.g. https://fonts.googleapis.com/css?family=Open+Sans) with locally hosted copies. To remove/unload Google Fonts entirely or by style/weight, go to <a href="#omgf-manage-optimized-fonts">Optimize Local Fonts</a>.', 'host-webfonts-local' ) ); -
apply_filters( 'omgf_dashboard_success_message', wp_kses_post( sprintf( __( 'Cool! %s has detected all Google Fonts on your Site and is hosting them locally.', 'host-webfonts-local' ), apply_filters( 'omgf_settings_page_title', 'OMGF' ) ) ) ); -
apply_filters( 'omgf_delete_option', false, $setting ); -
apply_filters( 'omgf_developer_mode_description', sprintf( __( 'Enable this option (on all instances) to make it easier to migrate between Development/Testing/Staging/Production environments. %s', 'host-webfonts-local' ), $this->promo ) ); -
apply_filters( 'omgf_do_not_load_frontend_css', ! current_user_can( 'manage_options' ) ); -
apply_filters( 'omgf_do_not_load_frontend_js', ! current_user_can( 'manage_options' ) ); -
apply_filters( 'omgf_download', $download->download() ); -
apply_filters( 'omgf_download_max_file_size', self::MAX_FILE_SIZE ); -
apply_filters( 'omgf_filter_admin_optimized_fonts', self::$admin_optimized_fonts ?: [] ); -
apply_filters( 'omgf_filter_optimize_url', add_query_arg( $args, $url ) ); -
apply_filters( 'omgf_filter_optimized_fonts', self::$optimized_fonts ?: [] ); -
apply_filters( 'omgf_filter_preloaded_fonts', self::$preloaded_fonts ); -
apply_filters( 'omgf_filter_unloaded_fonts', self::$unloaded_fonts ); -
apply_filters( 'omgf_filter_unloaded_stylesheets', self::$unloaded_stylesheets ); -
apply_filters( 'omgf_font_api_hosts', self::FONT_API_HOSTS ); -
apply_filters( 'omgf_form_action', admin_url( 'options.php?tab=' . $this->active_tab ), $this->page, $this->active_tab ); -
apply_filters( 'omgf_frontend_optimized_fonts', self::$optimized_fonts ); -
apply_filters( 'omgf_frontend_preloaded_fonts', $preloaded_fonts ); -
do_action( 'omgf_frontend_process_before_ob_start' ); -
apply_filters( 'omgf_frontend_process_convert_pro_compatibility', str_contains( $id, 'cp-google-fonts' ) ); -
apply_filters( 'omgf_frontend_process_fonts_set', $id, $href ); -
apply_filters( 'omgf_frontend_process_parse_links', $found, $link, $urls ); -
do_action( 'omgf_frontend_process_preloads' ); -
apply_filters( 'omgf_frontend_process_url', $url ); -
apply_filters( 'omgf_generate_stylesheet_after', $stylesheet, $this->fonts ); -
apply_filters( 'omgf_google_fonts_checker_general_text', sprintf( __( 'OMGF\'s integrated Google Fonts Checker (introduced in v6) found Google Fonts implementations (added by your theme or a plugin) that cannot be automatically processed.', 'host-webfonts-local' ), apply_filters( 'omgf_settings_page_title', 'OMGF' ) ) ); -
apply_filters( 'omgf_google_fonts_checker_no_potential_issues', sprintf( __( 'You can read <a href="%s" rel="noopener noreferrer" target="_blank">this guide</a> and attempt to fix it manually or, <a href="%s" rel="noopener noreferrer" target="_blank">upgrade to OMGF Pro</a> to fix it automatically.', 'host-webfonts-local' ), 'https://daan.dev/docs/omgf-pro-troubleshooting/external-requests/', Settings::DAAN_WORDPRESS_OMGF_PRO ) ); -
apply_filters( 'omgf_google_fonts_checker_potential_issues', sprintf( __( 'Some (or all) of the entries listed here might coincide with the list of potential issues listed below in the yellow box. Fix them first and visit the links below, to refresh these results. In some cases, an <a href="%s" rel="noopener noreferrer" target="_blank">upgrade to OMGF Pro</a> might be required.', 'host-webfonts-local' ), Settings::DAAN_WORDPRESS_OMGF_PRO ) ); -
apply_filters( 'omgf_google_fonts_checker_title', sprintf( __( '%1$s wasn\'t able to process all Google Fonts on your site. %2$s', 'host-webfonts-local' ), apply_filters( 'omgf_settings_page_title', 'OMGF' ), count( $google_fonts_checker_results ) === 5 ? '*' : '' ) ); -
apply_filters( 'omgf_has_multilang_plugin', ! empty( self::get_multilang_plugin() ) ); -
apply_filters( 'omgf_help_tab_plugin_url', 'https://wordpress.org/plugins/host-webfonts-local/' ); -
apply_filters( 'omgf_help_tab_review_link', 'https://wordpress.org/support/plugin/host-webfonts-local/reviews/?rate=5#new-post' ); -
apply_filters( 'omgf_import_export_font_settings', [ Settings::OMGF_OPTIMIZE_SETTING_CACHE_KEYS, Settings::OMGF_OPTIMIZE_SETTING_UNLOAD_STYLESHEETS, ] ); -
apply_filters( 'omgf_import_export_font_variant_properties', [ 'id', 'fontFamily', 'fontStyle', 'fontWeight', 'woff2', 'woff', 'subset', 'range' ] ); -
apply_filters( 'omgf_import_export_is_valid_setting', true, $key, $value ); -
apply_filters( 'omgf_import_export_meta', [ 'exported_at' => gmdate( 'c' ), 'site_url' => get_site_url(), 'includes_fonts' => (bool) $include_fonts, 'versions' => [ 'omgf' => get_file_data( OMGF_PLUGIN_FILE, [ 'Version' => 'Version' ] )['Version'], ], ] ); -
apply_filters( 'omgf_import_export_options', $options ); -
apply_filters( 'omgf_is_running_optimize', ( array_key_exists( 'omgf_optimize', $params ) || $is_running ) ); -
apply_filters( 'omgf_local_fonts_check_replace', '', $handle, $font->id ); -
apply_filters( 'omgf_local_fonts_disable_preload', false ); -
apply_filters( 'omgf_local_fonts_disable_replace', ! defined( 'OMGF_PRO_ACTIVE' ), $handle, $font->id ); -
apply_filters( 'omgf_local_fonts_disable_unload', false ); -
apply_filters( 'omgf_local_fonts_hide_fallback_font_stacks', false ); -
apply_filters( 'omgf_local_fonts_selected_fallback_font_stack', '', $handle, $font->id, $value ); -
apply_filters( 'omgf_non_autoloaded_options', self::OMGF_NON_AUTOLOADED_OPTIONS ); -
apply_filters( 'omgf_optimize_fonts_object', $object, $stylesheet ); -
apply_filters( 'omgf_optimize_fonts_object_subsets', $this->parse_subsets( $stylesheet, $font_family ), $stylesheet, $font_family, $this->url ); -
apply_filters( 'omgf_optimize_fonts_object_variants', $this->parse_variants( $stylesheet, $font_family ), $stylesheet, $font_family, $this->url ); -
do_action( 'omgf_optimize_local_fonts_fallback_font_stacks', $font->family, $font->id, $handle ); -
do_action( 'omgf_optimize_local_fonts_replace', $handle, $font->id ); -
apply_filters( 'omgf_optimize_run_args', [ 'omgf_optimize' => wp_create_nonce( 'omgf_optimize' ), 'nocache' => substr( md5( microtime() ), wp_rand( 0, 26 ), 5 ), ] ); -
apply_filters( 'omgf_optimize_run_require_https', true ); -
apply_filters( 'omgf_optimize_stylesheet_content_types', [ 'text/css', 'text/x-css', 'application/css', 'application/x-css' ] ); -
do_action( 'omgf_optimize_succeeded' ); -
apply_filters( 'omgf_optimize_url', $url ); -
apply_filters( 'omgf_performance_checker_general_text', __( 'OMGF\'s Font Performance Checker detected issues affecting your load times.', 'host-webfonts-local' ) ); -
apply_filters( 'omgf_performance_checker_notice', ( $show_unused || $show_delay || $show_cls ) && ! get_transient( Settings::OMGF_DISMISS_NOTICE_TRANSIENT . get_current_user_id() ) ); -
apply_filters( 'omgf_performance_checker_show_cta', ! defined( 'OMGF_PRO_ACTIVE' ) ); -
apply_filters( 'omgf_performance_checker_show_multilang', self::has_multilang_plugin() && $count_subsets > 1 ); -
do_action( "omgf_pre_update_setting_{$setting_name}", $setting_name, $setting_value ); -
apply_filters( 'omgf_pro_fallback_font_stacks', Settings::OMGF_FALLBACK_FONT_STACKS_OPTIONS ); -
apply_filters( 'omgf_pro_promo', sprintf( __( '<a href="%s" target="_blank">Upgrade to Pro</a> to unlock this option.', 'host-webfonts-local' ), esc_url( Settings::DAAN_WORDPRESS_OMGF_PRO ) ) ); -
apply_filters( 'omgf_process_search_replace', [ 'search' => $search, 'replace' => $replace, ] ); -
do_action( 'omgf_return_buffer' ); -
apply_filters( 'omgf_settings', wp_parse_args( self::$settings, $defaults ) ); -
apply_filters( 'omgf_settings_constants', $reflection->getConstants() ); -
do_action( 'omgf_settings_content' ); -
apply_filters( 'omgf_settings_defaults', $defaults ); -
apply_filters( 'omgf_settings_help_faq_link', 'https://daan.dev/docs/omgf-pro-faq/' ); -
apply_filters( 'omgf_settings_help_quick_start', 'https://daan.dev/docs/omgf-pro/quick-start' ); -
apply_filters( 'omgf_settings_help_support_link', 'https://daan.dev/contact/' ); -
apply_filters( 'omgf_settings_help_troubleshooting_link', 'https://daan.dev/docs/omgf-pro-troubleshooting/' ); -
apply_filters( 'omgf_settings_help_user_manual', 'https://daan.dev/docs/omgf-pro/' ); -
do_action( 'omgf_settings_imported', $options ); -
apply_filters( 'omgf_settings_needle', 'OMGF_OPTIMIZE_SETTING_' ); -
apply_filters( 'omgf_settings_option_name', "omgf_settings[$setting ); -
do_action( 'omgf_settings_tab' ); -
apply_filters( 'omgf_stylesheet_generator_font_face', $css, $properties ); -
apply_filters( 'omgf_task_manager_notice_class', 'alert' ); -
apply_filters( 'omgf_uninstall_db_entries', array_merge( $db_rows, [ 'omgf_settings' ] ) ); -
apply_filters( 'omgf_upload_dir', WP_CONTENT_DIR . '/uploads/omgf' ); -
apply_filters( 'omgf_upload_url', str_replace( [ 'http:', 'https:' ], '', WP_CONTENT_URL . '/uploads/omgf' ) );
Generated from OMGF's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.
Done for you
Rather have it built for you?
Tell us what should change and we’ll write and test the code using these hooks.
Custom hook snippet
from $49
A small, update-safe change built on the plugin’s own hooks.
- Code written against the plugin’s actions and filters
- Tested on a staging copy of your site
- Install instructions included
Typical turnaround: 2–3 business days
Choose thisPlugin customisation
from $149
New features or changed behaviour, without editing the plugin’s files.
- Built as a companion plugin, so updates never wipe it
- Exact quote before we start
- Tested on staging, then deployed
Typical turnaround: 3–7 business days
Choose thisNot sure which fits? Describe what you need and we’ll suggest the simplest option.
Can't find the right hook?
We can build the customisation for you. Describe what you need: