Image SEO Optimizer

Actions Reference

Every do_action() the plugin fires, including the REST and scoring hooks added in 1.0.6.

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

Image SEO Optimizer fires action hooks at every meaningful point in its lifecycle — plugin boot, admin UI rendering, the optimization flow, REST writes, settings save, page-builder URL updates, file rename, and uninstall. Hook into them with WordPress’s standard add_action() to extend or observe the plugin without modifying its source.

info

This page is for developers

If you’re configuring or using the plugin, you don’t need this page — head to the introduction instead. This reference documents the internal extension points used by the Pro plugin and intended for third-party integration.

The hooks worth knowing

The free plugin fires 45 action hooks. These are the ones most extensions need, and each is covered in more detail in the reference tables below.

Most-used extension points

Feature Use it for
infyp_register_model_configs Register custom AI models. Add a model to the AI Model dropdown — Pro registers Claude 4.5 Sonnet, Gemini 3.1 Pro and GPT-5 mini through it.
infyp_rest_routes Register REST routes on infyp/v1. Add your own endpoints to the plugin namespace instead of opening a second one — Pro adds /jobs and the page-context routes here.
infyp_image_optimized After a successful optimization. Trigger external workflows after the AI writes new metadata for an image — sync to a CMS, send a notification, run downstream automation.
infyp_before_ai_api_call / infyp_after_ai_api_call AI call lifecycle. Log every AI request and response, enforce custom rate limits, inspect failure modes, integrate with external monitoring.
infyp_filename_updated After a filename rename completes. Mirror the change to external systems — a CDN URL list, an external search index, a separate cache layer.
infyp_modal_context_section Render UI inside edit modals. Inject custom UI into the filename, alt text, title and keywords modals — Pro renders its Page Context panel there.
infyp_fab_button Render UI on the main dashboard. Add custom floating action buttons or quick-action UI on the main image table page — Pro uses this for its Bulk Optimize FAB.

Plugin lifecycle

Boot & uninstall

Setting Description
infyp_loaded Fires after the main plugin instance is fully initialized — third-party code starts here. Parameters: none. Source: infy-ai-image-seo-optimizer.php:229.
infyp_before_uninstall Before uninstall cleanup runs. Use to deregister your own data or back up plugin state. Parameters: none. Source: uninstall.php:41.
infyp_uninstall_complete After all uninstall cleanup is done. Parameters: none. Source: uninstall.php:257.

Admin UI render points

Main dashboard

Setting Description
infyp_fab_button In the image-list view header. Pro renders the Bulk Optimize FAB here. Parameters: none. Source: includes/views/main-page.php:73.
infyp_before_display_table / infyp_after_display_table Wrap the whole main page render, including the view file itself. Parameters: none. Source: includes/Admin/INFYP_Admin_Pages.php:903, :907.
infyp_before_table_display / infyp_after_table_display Wrap the image list table inside the view. Parameters: none. Source: includes/views/main-page.php:78, :80.
infyp_after_image_list_table After the complete image-list-table section. Use to append additional dashboard panels. Parameters: none. Source: includes/views/main-page.php:90.
infyp_after_main_page_content Very bottom of the main page content. Use sparingly — most extensions belong inside the table area. Source: includes/views/main-page.php:107.

Settings, modals and other admin pages

Setting Description
infyp_before_settings_cards / infyp_after_settings_cards Wrap the SEO settings cards on the SEO Score page. Source: includes/views/seo-score-page.php:36, :685.
infyp_modal_context_section Inside the filename, alt text, title and keywords modals. Pro renders its Page Context panel here, and fires the same action in its own caption and description modals. Parameters: $image_id (int). Source: includes/views/modals/filename-modal.php:52, title-modal.php:52, alt-text-modal.php:51, keywords-modal.php:72.
infyp_after_api_key_fields After the API-key input fields on both the setup wizard step and the standalone API Keys page. Parameters: none. Source: includes/views/api-keys-page.php:308, includes/views/setup-wizard/steps/step-api-keys.php:239.
infyp_before_redirects_table / infyp_after_redirects_table Wrap the Redirects Manager list table. Parameters: $redirect_list_table (instance). Source: includes/views/redirects-page.php:67, :87.
infyp_before_changelog_table / infyp_after_changelog_table Wrap the Change History list table. Parameters: $changelog_list_table (instance). Source: includes/views/changelog-page.php:30, :48.
infyp_dashboard_extended_field_stats Inside the image-stats metabox. Pro uses this to render the Captions and Descriptions cards. Parameters: $stats (array), $total_images (int). Source: includes/views/metaboxes/image-stats-metabox.php:100.
infyp_render_filter_category_badge Render custom badges in the image-table filter row. Parameters: $option (array), $value (mixed). Source: includes/Tables/INFYP_Image_List_Filters.php:385.
infyp_debug_page_after_sections After all built-in debug-page sections. The page only renders when WP_DEBUG is on, so nothing hooked here appears on a production site. Parameters: none. Source: includes/views/debug-page.php:1075.

AI optimization flow

Optimization lifecycle

Setting Description
infyp_register_model_configs Register custom AI models — the most-used Pro extension point. Pro adds Claude 4.5 Sonnet, Gemini 3.1 Pro and GPT-5 mini here. Parameters: $registry (INFYP_Model_Config_Registry). Source: includes/Core/AI/INFYP_Model_Config_Registry.php:190.
infyp_before_image_optimization Before a full optimization runs, whatever started it — the dashboard, a REST write, WP-CLI or a background job all pass through the same service. Parameters: $image_id (int). Source: includes/Core/INFYP_Optimization_Service.php:166.
infyp_before_ai_api_call Just before any AI API request. Three call sites cover the three call types (full / keywords / single_field). Parameters: $call_type (string), $model (string), $resolved_model (string), $provider_slug (string), $image_id (int). Source: includes/Core/AI/INFYP_AI_Provider_Manager.php:301, :357, :404.
infyp_after_ai_api_call Just after the AI API response is processed. Parameters: $call_type (string), $result (array|WP_Error), $model (string), $provider_slug (string), $image_id (int). Source: includes/Core/AI/INFYP_AI_Provider_Manager.php:316, :362, :409.
infyp_image_optimized After an image is optimized end-to-end and the new values are saved. A dry run skips it, because nothing was written. Parameters: $image_id (int), $new_data (array), $model_name (string). Source: includes/Core/INFYP_Optimization_Service.php:240.
infyp_track_api_usage When an AI call is tracked in the API Usage dashboard. Mirror this to external monitoring. Parameters: $provider (string), $model (string), $status (string), $data (array), $image_id (int|null). Source: includes/Core/INFYP_Plugin_API.php:879.
infyp_rate_limit_exceeded Fires when a rate-limited action exceeds its hourly threshold. Only actions listed in the infyp_rate_limited_actions map are counted — a direct call to a helper function is not. Parameters: $action (string), $user_id (int). Source: includes/Core/INFYP_Security_Manager.php:356.

File rename and page-builder updates

Rename lifecycle

Setting Description
infyp_file_renamed After the physical file rename succeeds on disk. Parameters: $post_id (int), $file_path (string), $new_path (string). Source: includes/Core/INFYP_File_Renamer.php:266.
infyp_filename_updated After the complete rename pipeline — on-disk rename plus page-builder rewrites. Parameters: $post_id (int), $url_map (array), $results (array). Source: includes/Core/INFYP_Filename_Updater.php:168.
infyp_filename_update_error When something in the rename pipeline fails. Parameters: $post_id (int), $e (Exception). Source: includes/Core/INFYP_Filename_Updater.php:174.
infyp_before_pagebuilder_url_updates Before image URLs are rewritten in page-builder content. Parameters: $url_map (array), $options (array). Source: includes/Core/PageBuilders/INFYP_PageBuilder_Manager.php:306.
infyp_after_pagebuilder_url_updates After page-builder URL rewrites complete. Parameters: $results (array), $url_map (array), $options (array). Source: includes/Core/PageBuilders/INFYP_PageBuilder_Manager.php:430.

Data & settings events

Settings, logging and cache

Setting Description
infyp_settings_updated After any plugin setting is saved. Four AJAX call sites, one per settings group, plus one on PATCH /settings. Parameters: none — read the option you care about. Source: includes/Ajax/INFYP_Settings_Ajax.php:236, :326, :428, :491 and includes/Rest/INFYP_REST_Settings_Controller.php:227.
infyp_scores_invalidated After cached SEO scores are discarded, which a scoring change does through the settings screen or over REST. The scores themselves are recomputed by the infyp_batch_cache_scores cron event, not in the request. Parameters: $count (int — cached scores discarded). Source: includes/Core/INFYP_SEO_Score_Calculator.php:1848.
infyp_log_field_change Before a field change is written to the changelog. Use to mirror changes to external audit systems. Parameters: $image_id (int), $field (string), $old_value (string), $new_value (string), $source (string|null). Source: includes/Core/INFYP_Plugin_API.php:816.
infyp_invalidate_image_cache When a single image's cache is invalidated. Parameters: $identifier (int — attachment ID). Source: includes/Core/INFYP_Plugin_API.php:922.
infyp_invalidate_all_caches When all plugin caches are cleared. Parameters: none. Source: includes/Core/INFYP_Plugin_API.php:938.
infyp_after_image_upload After a new image has been uploaded and its metadata generated. Parameters: $attachment_id (int), $metadata (array). Source: includes/Core/INFYP_Cache_Manager.php:921.
infyp_enqueue_addon_scripts Hook to enqueue extension JS / CSS on plugin admin pages. Parameters: $hook (string). Source: includes/Core/INFYP_Script_Manager.php:153.
infyp_enqueue_media_modal_scripts Enqueue scripts in the WordPress media modal. Parameters: $hook (string). Source: includes/Core/INFYP_Script_Manager.php:607.

REST API and background work

Four actions were added with the REST API in 1.0.6. All four run inside a REST request or an admin page render, so whatever you hook to them is paid for by the client waiting on the response.

REST lifecycle

Setting Description
infyp_rest_routes After the plugin registers its own routes, inside rest_api_init. Register additional routes on the same namespace here — the hook passes the namespace string and nothing else, so extensions couple to the published contract instead of a controller instance. Parameters: $rest_namespace (string, infyp/v1). Source: infy-ai-image-seo-optimizer.php:186.
infyp_rest_after_optimize After a successful optimization on POST /images/{id}/optimize or POST /images/{id}/field/{field}. It does not fire when the call returns an error, and it does fire on a dry run — check $result['dry_run'] before acting on the values. Parameters: $image_id (int), $result (array), $request (WP_REST_Request). Source: includes/Rest/INFYP_REST_Images_Controller.php:442, :510.
infyp_rest_scoring_updated After a write to /settings/scoring stores a new configuration — PATCH, PUT, and the DELETE that restores defaults. Parameters: $config (array with weights and parameters), $invalidated (int — cached scores discarded), $request (WP_REST_Request). Source: includes/Rest/INFYP_REST_Scoring_Controller.php:361, :391.
infyp_rest_admin_page_sections At the end of the REST API admin screen, after the counters, the chart, the activity log and the endpoint list. Pro renders its read-only jobs monitor here. Parameters: none. Source: includes/views/rest-api-page.php:95.

One more action comes from Pro rather than the free plugin, and it is a cron hook rather than a render or response point.

Background jobs

Setting Description
infyp_pro_job_tick Pro Pro. The WP-Cron hook that runs one batch of a server-side optimization job. Scheduled as single events only — the first one second after the job is created, each following one 30 seconds after the previous batch ends — so it never appears as a recurring schedule. Anything you hook to it runs inside the batch's 20-second wall-clock budget and eats into it. Parameters: $job_id (int). Source: infy-ai-image-seo-optimizer-pro/includes/Core/INFYP_Pro_Job_Runner.php:42, :88.

Next steps

Was this article helpful?

favorite

Thanks for your feedback!