Image SEO Optimizer

Filters Reference

Every apply_filters() the plugin exposes — the values you can change without touching plugin source.

schedule 1 min read update Updated 3 days ago local_offer Version 1.0.7

Filters let you modify values inside the plugin before they’re used. Where actions react to events, filters shape behavior — change which post types appear in the image table, what prompt the AI receives, which user role can save settings, what a REST response contains. Hook in with WordPress’s standard add_filter().

info

Developer audience

This page documents the plugin’s internal extension points. If you’re configuring or using the plugin, you don’t need this page. Actions (event-style hooks) live separately at Actions Reference, the public helper-function API at Public API, and the two surfaces added in 1.0.6 at REST API reference and WP-CLI commands.

Image query and table

Filters that shape what shows up in the image list table — which post types are scanned, which columns appear, how filters and search behave.

Image query

Setting Default Description
infyp_allowed_post_types Every public post type, plus media Which post types the image filter accepts, as a slug => slug map. The special media entry covers unattached images. Source: includes/Tables/INFYP_Image_Query_Builder.php:118.
infyp_valid_filter_types ['media', 'all'] plus the allowed post types Extend or restrict the filter values the table accepts — Pro adds product_cat when WooCommerce is active. Parameters: $valid_types (array), $allowed (array). Source: includes/Tables/INFYP_Image_Query_Builder.php:608.
infyp_taxonomy_filter_types [] Register taxonomy-based filters (Pro adds product_cat for WooCommerce). Source: includes/Tables/INFYP_Image_Query_Builder.php:738.
infyp_post_type_fallback_conditions Built-in conditions Customize SQL WHERE conditions for post-type filtering. Source: includes/Tables/INFYP_Image_Query_Builder.php:808.
infyp_image_query_where_conditions Default conditions Modify the SQL WHERE clause for the image query. Source: includes/Tables/INFYP_Image_Query_Builder.php:913.
infyp_image_query_args Query args Modify image query parameters before execution. Source: includes/Core/INFYP_Plugin_API.php:230.
infyp_post_type_filter_options Post-type filters Customize the Post Type filter dropdown above the image table. Source: includes/Tables/INFYP_Image_List_Filters.php:248.

Table columns

Setting Default Description
infyp_image_table_columns_before Default columns Prepend columns before the title. Pro uses this for the bulk-select checkbox. Source: includes/Tables/INFYP_Image_List_Table.php:354.
infyp_table_columns_after_title Columns after title Insert columns after the title. Pro inserts Caption + Description here. Source: includes/Tables/INFYP_Image_List_Table.php:364.
infyp_table_column_<column_name> '' Render custom content for one table column — the column slug is part of the hook name. Parameters: $content (string), $item (WP_Post). Source: includes/Tables/INFYP_Image_Column_Renderer.php:708.

AI prompts and optimization

Prompts

Setting Default Description
infyp_optimize_prompt The caller's custom prompt, or '' Set the prompt override for a single generation request, from any entry point — dashboard, REST, WP-CLI or a job. The returned string replaces the global prompt addon and the infyp_image_context output entirely. Treat a truthy $args['dry_run'] as a signal to store nothing. Parameters: $custom_prompt (string), $image_id (int), $args (array, including the caller's options). Source: includes/Core/INFYP_Optimization_Service.php:288.
infyp_image_context '' Inject contextual info into AI prompts. Pro uses this for WooCommerce product data. Source: includes/Core/INFYP_AI_Optimizer.php:381, :544.
infyp_prompt_addon '' Add per-field-type context to AI prompts. Source: includes/Core/INFYP_AI_Optimizer.php:532.
infyp_prompt_sections Default sections Customize the structured prompt sections sent to the AI. Source: includes/Core/AI/INFYP_Prompt_Builder.php:117, :171.
infyp_single_field_prompt Generated prompt Customize the single-field optimization prompt. Source: includes/Core/AI/INFYP_Prompt_Builder.php:132.
infyp_keywords_prompt Generated keywords prompt Customize the keyword-extraction prompt. Source: includes/Core/AI/INFYP_Prompt_Builder.php:184.
infyp_extended_field_prompt null Custom prompt for extended (registered) field types — e.g. caption / description in Pro. Source: includes/Core/AI/INFYP_Prompt_Builder.php:63.
infyp_simplified_prompt Simplified prompt Customize simplified prompts that some models prefer. Source: includes/Core/AI/INFYP_Prompt_Builder.php:227.
infyp_prompt_format The model's registered prompt_format Override the response format asked of a model: json, json_plain or tool_use. WordPress AI Connectors hook this filter and force json_plain while they are the active connection method, so a callback of your own has to run at a later priority to win. Parameters: $format (string), $model (string), $provider (string). Source: includes/Core/AI/INFYP_Prompt_Builder.php:267; the connector override at includes/Core/AI/INFYP_WP_AI_Support.php:327, :383.
infyp_max_prompt_length 1000 Max character length for a custom prompt, applied on save and on every REST write. Source: includes/Ajax/INFYP_Settings_Ajax.php:187, includes/Rest/INFYP_REST_Images_Controller.php:142, includes/Rest/INFYP_REST_Settings_Controller.php:118, :248.

Optimization results

Setting Default Description
infyp_ai_response_possible_keys Provider response keys Alternate JSON keys to look for in AI responses. Useful when adapting to model quirks. Source: includes/Core/AI/INFYP_OpenAI_Provider.php:432, INFYP_Gemini_Provider.php:337, INFYP_WP_AI_Provider.php:132.
infyp_after_ai_optimization Optimization results Modify the AI-generated data after it is applied. Skipped on a dry run, so values added here are absent from dry-run results. Parameters: $new_data (array), $image_id (int), $model_name (string). Source: includes/Core/INFYP_Optimization_Service.php:230.
infyp_allowed_optimize_field_types ['filename', 'alt_text', 'title'] Extend which fields can be individually optimized — Pro adds caption and description. The same list gates the AJAX route, the service and the REST field route. Source: includes/Core/INFYP_Optimization_Service.php:506, includes/Ajax/INFYP_AI_Ajax.php:284, includes/Rest/INFYP_REST_Controller.php:159.
infyp_extended_field_types [] Register custom field types for optimization. Source: includes/Core/INFYP_AI_Optimizer.php:456.
infyp_optimize_extended_field null Provide a result for a custom extended field — return non-null to bypass the AI flow. Source: includes/Core/INFYP_AI_Optimizer.php:458.
infyp_optimize_field_result null Override the result of a single-field optimization. Parameters: $result (null|array), $image_id (int), $field_type (string), $existing_keywords (array|null), $custom_prompt (string). Source: includes/Core/INFYP_Optimization_Service.php:534.
infyp_save_extended_field_result null Save handler for a field type the free plugin does not know how to persist. Return an array with new_value and changelog_data to claim the save; return null and the field is rejected. Pro registers it for caption and description, which is what makes those fields work over REST, WP-CLI, cron and jobs (Pro 1.0.1). Parameters: $result (null|array), $image_id (int), $field_type (string), $value (array), $current_value (mixed) — 5 args. Source: includes/Core/INFYP_Optimization_Service.php:630, :819.
infyp_generated_keywords Generated keywords Modify the keywords list before it's saved. Source: includes/Ajax/INFYP_AI_Ajax.php:484.
infyp_process_ai_result_data Processed result Post-process all AI results before saving. Source: includes/Core/INFYP_Optimization_Service.php:325.
infyp_filename_before_apply Generated filename Customize a filename right before it's applied to the file. Source: includes/Core/INFYP_Optimization_Service.php:400.
infyp_max_keywords 3 Max keywords accepted from an AI response. Source: includes/Core/AI/INFYP_Response_Cleaner.php:84, :195 and includes/Core/INFYP_Optimization_Service.php:330.
infyp_api_retry_config Built-in retry config Customize AI API retry behavior (max retries, backoff). Source: includes/Core/INFYP_API_Retry_Handler.php:54.

AI providers and models

Provider registration

Setting Default Description
infyp_register_ai_providers Built-in providers Register custom AI provider implementations alongside the built-in Anthropic, Google and OpenAI providers. Source: includes/Core/AI/INFYP_AI_Provider_Manager.php:190.
infyp_allowed_api_key_providers INFYP_API_Key_Manager::BUILTIN_PROVIDERS Restrict or extend which providers can have API keys saved. Source: includes/Core/INFYP_API_Key_Manager.php:137, includes/Ajax/INFYP_Settings_Ajax.php:288, :377, includes/Admin/INFYP_Settings.php:118, :190, includes/Admin/INFYP_Setup_Wizard.php:612.
infyp_api_key_test_endpoints One request definition per built-in provider Register the request the Test Key button sends for your provider, so the button works for it too. Each entry is url plus headers, and a header value may carry the %key% placeholder. The built-in calls list models, which costs no tokens. Parameters: $endpoints (array keyed by provider slug). Source: includes/Core/INFYP_API_Key_Manager.php:413.
infyp_provider_for_model null Override the provider-for-model resolution at the API-key-manager level. Source: includes/Core/INFYP_API_Key_Manager.php:571.
infyp_model_labels Built-in display names Customize the display names of models in the dropdown. Source: includes/Core/INFYP_Script_Manager.php:194.
infyp_ai_models Registered models Customize the full list of available models in settings. Source: includes/Admin/INFYP_Admin_Pages.php:848.

SEO scoring

Score calculation

Setting Default Description
infyp_seo_score_thresholds Default thresholds Override per-field min/max character and word thresholds. Source: includes/Core/INFYP_SEO_Score_Calculator.php:709.
infyp_seo_score_result Score result Modify the final calculated score result. Parameters: $result (array), $image_id (int). Source: includes/Core/INFYP_SEO_Score_Calculator.php:750.

Page builders and file rename

Page-builder adapters

Setting Default Description
infyp_register_pagebuilder_adapters The six built-in adapters Register an adapter for a builder the plugin does not ship, so its content is included in filename rewrites. Gutenberg, Elementor, WPBakery, Visual Composer, Uncode and Divi are built in — Divi has shipped since 1.0.4, so it no longer needs this filter. Anything that does not implement INFYP_PageBuilder_Adapter_Interface is dropped right after the filter runs. Source: includes/Core/PageBuilders/INFYP_PageBuilder_Manager.php:269.
infyp_custom_adapter_processing null Take over the rewrite pass for one adapter. Return an array with updated_posts and errors to bypass the adapter's own processing, or null to leave it alone. Parameters: $custom_result (null|array), $key (string), $adapter (object), $url_map (array). Source: includes/Core/PageBuilders/INFYP_PageBuilder_Manager.php:347.
infyp_pagebuilder_adapter_info Adapter metadata Customize the metadata shown for each registered adapter. Source: includes/Core/PageBuilders/INFYP_PageBuilder_Manager.php:498.
infyp_detect_page_builder '' Manually classify which page builder is used for a given image. Source: includes/Core/INFYP_Image_Usage.php:347.
infyp_filename_url_map URL map Customize the filename-to-URL mapping before a rewrite pass. Source: includes/Core/INFYP_Filename_Updater.php:348.
infyp_pre_file_rename true Return false to prevent a file rename from occurring. Source: includes/Core/INFYP_File_Renamer.php:184.

Image usage detection

Usage tracker

Setting Default Description
infyp_image_usage_post_ids [] Register additional posts where an image is used. Source: includes/Core/INFYP_Image_Usage.php:191.
infyp_image_usage_taxonomy [] Register taxonomy/term usage of an image. Source: includes/Core/INFYP_Image_Usage.php:195.
infyp_image_usage_types Built-in types Add a custom image-usage type — Pro adds Product Featured / Gallery / Category Thumbnail. Source: includes/Core/INFYP_Image_Usage.php:269.
infyp_find_image_usage Usage results Modify the final image-usage result before returning. Source: includes/Core/INFYP_Plugin_API.php:846.
infyp_image_usage_html HTML markup Customize the image-usage HTML rendered in the Usage modal. Source: includes/Ajax/INFYP_Image_Ajax.php:377.

Settings, security and API

Plugin API overrides

Setting Default Description
infyp_get_setting Setting value Override any plugin setting at read time. Source: includes/Core/INFYP_Plugin_API.php:81.
infyp_get_api_key Decrypted key Override or mask the API key returned to consumers. Source: includes/Core/INFYP_Plugin_API.php:111.
infyp_get_active_model Configured model Override the active AI model per request. Source: includes/Core/INFYP_Plugin_API.php:133.
infyp_get_language Configured language Override the language for AI prompts. Source: includes/Core/INFYP_Plugin_API.php:155.
infyp_get_provider_for_model Provider slug Override the auto-derived provider for a given model. Source: includes/Core/INFYP_Plugin_API.php:185.
infyp_get_image_ids / infyp_get_image_count Query result Modify image IDs or total count returned by the public API. Source: includes/Core/INFYP_Plugin_API.php:256, :301.
infyp_query_images_args / infyp_query_images_result Query args / result Shape the context-safe query used by REST, WP-CLI and cron: arguments in, then the items, total and cursor that come back. Source: includes/Core/INFYP_Plugin_API.php:628, :655.
infyp_unoptimized_image_ids The queried ID batch Change the batch of never-optimized IDs a bulk run iterates over. Parameters: $ids (int[]), $after_id (int — keyset cursor), $limit (int). Source: includes/Core/INFYP_Plugin_API.php:689.
infyp_run_single_field_optimization / infyp_run_optimization Optimization result Intercept the result of a generate-only optimization call before it's returned. Source: includes/Core/INFYP_Plugin_API.php:347, :381.
infyp_run_optimize_and_save / infyp_run_optimize_field_and_save Result envelope Intercept the result of a generate-and-save call, the pipeline REST, WP-CLI and jobs all use. Source: includes/Core/INFYP_Plugin_API.php:426, :527.
infyp_apply_optimization_result / infyp_run_apply_field Applied field data Intercept a save that carries no generation — a full result you already hold, or a single field value. Source: includes/Core/INFYP_Plugin_API.php:480, :562.
infyp_get_image_base64 Base64 data Provide an alternate image-data source for AI calls. Source: includes/Core/INFYP_Plugin_API.php:715.
infyp_validate_image_id / infyp_check_capability true / false Customize image validation and capability checks. Source: includes/Core/INFYP_Plugin_API.php:750, :783.
infyp_calculate_api_cost Calculated cost Customize the API cost calculation for the Usage dashboard. Source: includes/Core/INFYP_API_Usage_Tracker.php:193.

Security and capability

Setting Default Description
infyp_rate_limits api_calls 100/hour, filename_updates 500/hour Customize the per-user hourly buckets. Both windows are 3600 seconds and both are counted per user, not per application password. Source: includes/Core/INFYP_Security_Manager.php:173.
infyp_rate_limited_actions infyp_optimize_with_ai, infyp_update_filename Map an action name onto a bucket. An action missing from the map is not limited at all, which is why a direct call to a helper function passes straight through. The REST layer adds infyp_rest_optimize and infyp_rest_field_optimize to the api_calls bucket through this filter. Source: includes/Core/INFYP_Security_Manager.php:375; the REST mapping at includes/Rest/INFYP_REST_Controller.php:72.
infyp_capability_map Default mapping Customize which WordPress capability each plugin action requires. An unmapped action falls through to manage_options. Source: includes/Core/INFYP_Security_Manager.php:310.
infyp_max_security_events 100 Max security events to retain. Source: includes/Core/INFYP_Security_Manager.php:495.
infyp_admin_menu_capability 'manage_options' Required capability to access plugin admin pages. Source: includes/Admin/INFYP_Admin_Pages.php:399, :545.

REST API

The infyp/v1 namespace added in 1.0.6 comes with its own filters. They cover the three things an extension usually needs from a REST layer: who is allowed in, what a response contains, and how long the activity log is kept.

Permissions and payloads

Setting Default Description
infyp_rest_optimize_permission true Veto or narrow an optimize call — return a WP_Error to deny it with your own reason. It runs after the built-in capability and per-image checks, so it can only tighten access, never widen it. Parameters: $allowed (true|WP_Error), $request (WP_REST_Request), $field (string|null — set on the field route). Source: includes/Rest/INFYP_REST_Images_Controller.php:264.
infyp_rest_images_query_args The prepared query args Change the query behind GET /images before it runs. Parameters: $args (array passed to infyp_query_images()), $request. Source: includes/Rest/INFYP_REST_Images_Controller.php:308.
infyp_rest_images_collection The prepared items Change the whole collection after every item is prepared. Parameters: $items (array), $request. Source: includes/Rest/INFYP_REST_Images_Controller.php:326.
infyp_rest_image_response The prepared image fields Add fields to a single image resource — Pro adds context_summary and has_context. It runs once per item, so a collection of 100 runs it 100 times: keep per-image queries out of it. Parameters: $data (array), $image_id (int), $request. Source: includes/Rest/INFYP_REST_Images_Controller.php:576.
infyp_rest_settings_response The settings payload Add to what GET /settings returns. Parameters: $settings (array). Source: includes/Rest/INFYP_REST_Settings_Controller.php:275.
infyp_rest_extensions [] Advertise an optional capability under extensions on the settings resource, so a client discovers in one request which options keys the optimize routes honor. Pro registers the context slug here. Parameters: $extensions (array keyed by extension slug). Source: includes/Rest/INFYP_REST_Settings_Controller.php:303.
infyp_rest_scoring_pre_save The merged configuration Adjust the merged scoring configuration before it is validated, so a rejected value never reaches storage. Parameters: $config (array with weights and parameters), $request. Source: includes/Rest/INFYP_REST_Scoring_Controller.php:322.
infyp_rest_scoring_response The scoring payload Change the scoring configuration payload on read and on write. Parameters: $payload (array). Source: includes/Rest/INFYP_REST_Scoring_Controller.php:432.
infyp_rest_log_retention_days 90 Change how long rows in the REST activity log are kept. Values below 1 are clamped up, so the log cannot be switched off through this filter. Parameters: $days (int). Source: includes/Database/INFYP_REST_Log.php:192.
info

Adding a route is an action, not a filter

Registering endpoints on the same namespace happens on the infyp_rest_routes action, documented in the Actions Reference. The routes themselves, with authentication, capabilities and rate limits, are on the REST API reference page.

UI and miscellaneous

UI, mime types and changelog

Setting Default Description
infyp_admin_header_badge '' Inject a badge into admin page headers — Pro uses this for the Pro badge. Source: includes/views/main-page.php:21, api-keys-page.php:24, api-usage-page.php:29, changelog-page.php:19, redirects-page.php:24, search-console-page.php:60, includes/Admin/INFYP_Admin_Pages.php:1126.
infyp_admin_i18n_strings Default i18n strings Override JS-localized strings used by the admin scripts. Source: includes/Core/INFYP_Script_Manager.php:220.
infyp_admin_localize_data Localized JS data Modify the data passed into the admin JS scripts (wp_localize_script). Source: includes/Core/INFYP_Script_Manager.php:574.
infyp_supported_mime_types Standard image MIME types Extend the list of supported image MIME types. Source: infy-ai-image-seo-optimizer.php:263.
infyp_show_extension_notices true Toggle Pro-upgrade notices and CTAs. Pro sets this to false. Source: infy-ai-image-seo-optimizer.php:633, includes/Admin/INFYP_Admin_Pages.php:546, :761.
infyp_changelog_entry Entry data Modify a changelog row before it's saved. Source: includes/Database/INFYP_Changelog.php:156.
infyp_provider_display_names Provider slugs Customize provider display names in the API Usage report. Source: includes/Tables/INFYP_API_Usage_List_Table.php:295.
infyp_usage_chart_provider_colors Default colors Customize the per-provider colors in the daily-usage chart. Source: includes/Admin/INFYP_API_Usage_Page.php:178.
infyp_allowed_edit_fields ['title', 'alt_text'] Extend which image fields can be edited via the AJAX field-edit endpoint. Source: includes/Ajax/INFYP_Image_Ajax.php:173.
infyp_handle_edit_field false Hook to handle a custom field edit AJAX call yourself. Source: includes/Ajax/INFYP_Image_Ajax.php:223.
infyp_reset_banner_meta_keys Default keys Customize which dismissable banner notices reset together. Source: includes/Ajax/INFYP_Notices_Ajax.php:129.
infyp_pro_woocommerce_product_context Product context string Customize the WooCommerce product context injected into AI prompts (Pro). Parameters: $context (string), $image_id (int), $products_found (array). Source: infy-ai-image-seo-optimizer-pro/includes/Features/INFYP_Pro_WooCommerce_Context.php:265.

Next steps

Was this article helpful?

favorite

Thanks for your feedback!