Complete reference of all action hooks available in AI Image SEO Optimizer. Use action hooks to run your own code at specific points in the plugin’s lifecycle — from image uploads and AI optimization to settings changes and UI rendering.
How to use action hooks
Add your callback with add_action() in your theme’s functions.php or a custom plugin. Your callback runs at the hook’s trigger point and its return value is ignored.
Optimization Lifecycle
infyp_after_image_upload
– Modify attachment metadata – Run AI optimization @since 1.0.0 @param int $attachment_id The attachment ID of the newly uploaded image. @param array $metadata The attachment metadata.
Parameters
| Name | Type | Description |
|---|---|---|
$attachment_id
|
mixed |
Parameter $attachment_id |
$metadata
|
mixed |
Parameter $metadata |
Example
add_action( 'infyp_after_image_upload', function( $attachment_id, $metadata ) {n // Handle infyp_after_image_uploadn error_log( 'infyp_after_image_upload: ' . print_r( $attachment_id, true ) );n}, 10, 2 );
infyp_before_image_optimization
Fires before an image is optimized with AI. @since 1.0.0 @param int $image_id The attachment ID being optimized.
Parameters
| Name | Type | Description |
|---|---|---|
$image_id
|
mixed |
Parameter $image_id |
Example
add_action( 'infyp_before_image_optimization', function( $image_id ) {n // Handle infyp_before_image_optimizationn error_log( 'infyp_before_image_optimization: ' . print_r( $image_id, true ) );n} );
infyp_image_optimized
Fires after an image has been fully optimized with AI. @since 1.0.0 @param int $image_id The attachment ID that was optimized. @param array $new_data The new optimization data applied. @param string $model_name The AI model used for optimization.
Parameters
| Name | Type | Description |
|---|---|---|
$image_id
|
mixed |
Parameter $image_id |
$new_data
|
mixed |
Parameter $new_data |
$model_name
|
mixed |
Parameter $model_name |
Example
add_action( 'infyp_image_optimized', function( $image_id, $new_data, $model_name ) {n // Handle infyp_image_optimizedn error_log( 'infyp_image_optimized: ' . print_r( $image_id, true ) );n}, 10, 3 );
infyp_log_field_change
@param int $image_id The attachment ID. @param string $field The field name. @param string $old_value The old value. @param string $new_value The new value. @param string|null $source The change source.
Parameters
| Name | Type | Description |
|---|---|---|
$image_id
|
mixed |
Parameter $image_id |
$field
|
mixed |
Parameter $field |
$old_value
|
mixed |
Parameter $old_value |
$new_value
|
mixed |
Parameter $new_value |
$source
|
mixed |
Parameter $source |
Example
add_action( 'infyp_log_field_change', function( $image_id, $field, $old_value, $new_value, $source ) {n // Handle infyp_log_field_changen error_log( 'infyp_log_field_change: ' . print_r( $image_id, true ) );n}, 10, 5 );
infyp_track_api_usage
@param string $provider The provider slug. @param string $model The model identifier. @param string $status The call status. @param array $data Extra tracking data. @param int|null $image_id The attachment ID.
Parameters
| Name | Type | Description |
|---|---|---|
$provider
|
mixed |
Parameter $provider |
$model
|
mixed |
Parameter $model |
$status
|
mixed |
Parameter $status |
$data
|
mixed |
Parameter $data |
$image_id
|
mixed |
Parameter $image_id |
Example
add_action( 'infyp_track_api_usage', function( $provider, $model, $status, $data, $image_id ) {n // Handle infyp_track_api_usagen error_log( 'infyp_track_api_usage: ' . print_r( $provider, true ) );n}, 10, 5 );
AI Providers & Prompts
infyp_before_ai_api_call
@param string $call_type The type of call ('full', 'keywords', 'single_field'). @param string $model The original model identifier. @param string $resolved_model The resolved model name for the API. @param string $provider_slug The provider slug handling the call. @param int $image_id The attachment ID being processed.
Parameters
| Name | Type | Description |
|---|---|---|
$model
|
mixed |
Parameter $model |
$resolved_model
|
mixed |
Parameter $resolved_model |
$provider
|
mixed |
Parameter $provider |
$image_id
|
mixed |
Parameter $image_id |
Example
add_action( 'infyp_before_ai_api_call', function( $model, $resolved_model, $provider, $image_id ) {n // Handle infyp_before_ai_api_calln error_log( 'infyp_before_ai_api_call: ' . print_r( $model, true ) );n}, 10, 4 );
infyp_register_model_configs
'keywords' => ['max_completion_tokens' => 8192, 'temperature' => null, 'response_format' => ['type' => 'json_object'], 'extra' => ['reasoning_effort' => 'low']], 'single_field' => ['max_completion_tokens' => 8192, 'temperature' => null, 'response_format' => ['type' => 'json_object'], 'extra' => ['reasoning_effort' => 'low']], ], 'pricing' => ['blended_per_million' => 3.00], ] ); } );
Parameters
| Name | Type | Description |
|---|---|---|
$this
|
mixed |
Parameter $this |
Example
add_action( 'infyp_register_model_configs', function( $this ) {n // Handle infyp_register_model_configsn error_log( 'infyp_register_model_configs: ' . print_r( $this, true ) );n} );
Settings & Configuration
infyp_settings_updated
This action is documented in includes/Ajax/INFYP_Settings_Ajax.php */
Example
add_action( 'infyp_settings_updated', function( ) {n // Your custom code heren error_log( 'infyp_settings_updated fired' );n} );
Image Data & Queries
infyp_invalidate_image_cache
Fires after an image cache is invalidated. @since 1.1.0 @param int $identifier The attachment ID.
Parameters
| Name | Type | Description |
|---|---|---|
$identifier
|
mixed |
Parameter $identifier |
Example
add_action( 'infyp_invalidate_image_cache', function( $identifier ) {n // Handle infyp_invalidate_image_cachen error_log( 'infyp_invalidate_image_cache: ' . print_r( $identifier, true ) );n} );
File Renaming & Redirects
infyp_file_renamed
Fires after a file has been successfully renamed. @since 1.0.0 @param int $post_id The attachment ID. @param string $old_path The previous file path. @param string $new_path The new file path.
Parameters
| Name | Type | Description |
|---|---|---|
$post_id
|
mixed |
Parameter $post_id |
$file_path
|
mixed |
Parameter $file_path |
$new_path
|
mixed |
Parameter $new_path |
Example
add_action( 'infyp_file_renamed', function( $post_id, $file_path, $new_path ) {n // Handle infyp_file_renamedn error_log( 'infyp_file_renamed: ' . print_r( $post_id, true ) );n}, 10, 3 );
infyp_filename_update_error
Fires when filename update error.
Parameters
| Name | Type | Description |
|---|---|---|
$post_id
|
mixed |
Parameter $post_id |
$e
|
mixed |
Parameter $e |
Example
add_action( 'infyp_filename_update_error', function( $post_id, $e ) {n // Handle infyp_filename_update_errorn error_log( 'infyp_filename_update_error: ' . print_r( $post_id, true ) );n}, 10, 2 );
infyp_filename_updated
Fires when filename updated.
Parameters
| Name | Type | Description |
|---|---|---|
$post_id
|
mixed |
Parameter $post_id |
$url_map
|
mixed |
Parameter $url_map |
$results
|
mixed |
Parameter $results |
Example
add_action( 'infyp_filename_updated', function( $post_id, $url_map, $results ) {n // Handle infyp_filename_updatedn error_log( 'infyp_filename_updated: ' . print_r( $post_id, true ) );n}, 10, 3 );
infyp_manual_filename_update
// When user renames attachment in Media Library, updates happen automatically // Manual trigger: $url_map = [ 'old-url.jpg' => 'new-url.jpg', 'old-url-300×200.jpg' => 'new-url-300×200.jpg' ];
Parameters
| Name | Type | Description |
|---|---|---|
$attachment_id
|
mixed |
Parameter $attachment_id |
$url_map
|
mixed |
Parameter $url_map |
Example
add_action( 'infyp_manual_filename_update', function( $attachment_id, $url_map ) {n // Handle infyp_manual_filename_updaten error_log( 'infyp_manual_filename_update: ' . print_r( $attachment_id, true ) );n}, 10, 2 );
Table & UI
infyp_after_api_key_fields
Extensions registering custom AI providers can use this hook to render additional API key input fields. Each card should follow the same HTML structure as the built-in cards (infyp-card with data-provider attribute). @since 1.0.0
Example
add_action( 'infyp_after_api_key_fields', function( ) {n // Your custom code heren error_log( 'infyp_after_api_key_fields fired' );n} );
infyp_after_display_table
Fires when after display table.
Example
add_action( 'infyp_after_display_table', function( ) {n // Your custom code heren error_log( 'infyp_after_display_table fired' );n} );
infyp_after_image_list_table
Action hook to add custom content after the image list table. This hook allows for the addition of custom functionality, such as modals, immediately after the image list table display. @since 1.0.0
Example
add_action( 'infyp_after_image_list_table', function( ) {n // Your custom code heren error_log( 'infyp_after_image_list_table fired' );n} );
infyp_after_main_page_content
Action hook to add custom content after the main page content. This hook allows for the addition of custom functionality, such as modals, to the main page of the plugin. @since 1.0.0
Example
add_action( 'infyp_after_main_page_content', function( ) {n // Your custom code heren error_log( 'infyp_after_main_page_content fired' );n} );
infyp_after_settings_cards
Fires after all settings cards on the Settings page. Extensions can use this hook to add additional settings cards. @since 1.0.0
Example
add_action( 'infyp_after_settings_cards', function( ) {n // Your custom code heren error_log( 'infyp_after_settings_cards fired' );n} );
infyp_after_table_display
Fires when after table display.
Example
add_action( 'infyp_after_table_display', function( ) {n // Your custom code heren error_log( 'infyp_after_table_display fired' );n} );
infyp_before_display_table
Set action to indicate we're displaying the table
Example
add_action( 'infyp_before_display_table', function( ) {n // Your custom code heren error_log( 'infyp_before_display_table fired' );n} );
infyp_before_settings_cards
Fires before all settings cards on the Settings page. Extensions can use this hook to add cards at the top. @since 1.0.0
Example
add_action( 'infyp_before_settings_cards', function( ) {n // Your custom code heren error_log( 'infyp_before_settings_cards fired' );n} );
infyp_before_table_display
Set a flag to indicate we're rendering the table
Example
add_action( 'infyp_before_table_display', function( ) {n // Your custom code heren error_log( 'infyp_before_table_display fired' );n} );
infyp_dashboard_extended_field_stats
Hook for extensions to add additional field stats @param array $stats All dashboard statistics @param int $total_images Total number of images
Parameters
| Name | Type | Description |
|---|---|---|
$stats
|
mixed |
Parameter $stats |
$total_images
|
mixed |
Parameter $total_images |
Example
add_action( 'infyp_dashboard_extended_field_stats', function( $stats, $total_images ) {n // Handle infyp_dashboard_extended_field_statsn error_log( 'infyp_dashboard_extended_field_stats: ' . print_r( $stats, true ) );n}, 10, 2 );
infyp_debug_page_after_sections
Hook for extensions to add debug sections @since 1.0.0
Example
add_action( 'infyp_debug_page_after_sections', function( ) {n // Your custom code heren error_log( 'infyp_debug_page_after_sections fired' );n} );
infyp_enqueue_addon_scripts
Hook for addons to enqueue their scripts
Parameters
| Name | Type | Description |
|---|---|---|
$hook
|
mixed |
Parameter $hook |
Example
add_action( 'infyp_enqueue_addon_scripts', function( $hook ) {n // Handle infyp_enqueue_addon_scriptsn error_log( 'infyp_enqueue_addon_scripts: ' . print_r( $hook, true ) );n} );
infyp_enqueue_media_modal_scripts
Fires on media-related admin pages (post.php, post-new.php, upload.php) so extensions can enqueue their own media library integration scripts. @since 1.0.0 @param string $hook The current admin page hook suffix.
Parameters
| Name | Type | Description |
|---|---|---|
$hook
|
mixed |
Parameter $hook |
Example
add_action( 'infyp_enqueue_media_modal_scripts', function( $hook ) {n // Handle infyp_enqueue_media_modal_scriptsn error_log( 'infyp_enqueue_media_modal_scripts: ' . print_r( $hook, true ) );n} );
infyp_fab_button
Fires when fab button.
Example
add_action( 'infyp_fab_button', function( ) {n // Your custom code heren error_log( 'infyp_fab_button fired' );n} );
infyp_modal_context_section
Fires when modal context section.
Parameters
| Name | Type | Description |
|---|---|---|
$image_id
|
mixed |
Parameter $image_id |
Example
add_action( 'infyp_modal_context_section', function( $image_id ) {n // Handle infyp_modal_context_sectionn error_log( 'infyp_modal_context_section: ' . print_r( $image_id, true ) );n} );
infyp_render_filter_category_badge
Render custom category badges for extension-registered post types. @since 1.0.0 @param array $option The filter option array. @param string $slug The post type slug.
Parameters
| Name | Type | Description |
|---|---|---|
$option
|
mixed |
Parameter $option |
$value
|
mixed |
Parameter $value |
Example
add_action( 'infyp_render_filter_category_badge', function( $option, $value ) {n // Handle infyp_render_filter_category_badgen error_log( 'infyp_render_filter_category_badge: ' . print_r( $option, true ) );n}, 10, 2 );
Security & Rate Limiting
infyp_rate_limit_exceeded
Fires when rate limit exceeded.
Parameters
| Name | Type | Description |
|---|---|---|
$action
|
mixed |
Parameter $action |
$user_id
|
mixed |
Parameter $user_id |
Example
add_action( 'infyp_rate_limit_exceeded', function( $action, $user_id ) {n // Handle infyp_rate_limit_exceededn error_log( 'infyp_rate_limit_exceeded: ' . print_r( $action, true ) );n}, 10, 2 );
Page Builders
infyp_after_pagebuilder_url_updates
– total_updated_posts: Array of updated post IDs – total_errors: Array of error messages – adapter_results: Results from each adapter – processing_time: Total processing time in seconds @param array $url_map URL mappings that were processed @param array $options Processing options
Parameters
| Name | Type | Description |
|---|---|---|
$results
|
mixed |
Parameter $results |
$url_map
|
mixed |
Parameter $url_map |
$options
|
mixed |
Parameter $options |
Example
add_action( 'infyp_after_pagebuilder_url_updates', function( $results, $url_map, $options ) {n // Handle infyp_after_pagebuilder_url_updatesn error_log( 'infyp_after_pagebuilder_url_updates: ' . print_r( $results, true ) );n}, 10, 3 );
infyp_before_pagebuilder_url_updates
or perform pre-processing tasks. @since 1.0.0 @param array $url_map URL mappings (old_url => new_url) @param array $options Processing options
Parameters
| Name | Type | Description |
|---|---|---|
$url_map
|
mixed |
Parameter $url_map |
$options
|
mixed |
Parameter $options |
Example
add_action( 'infyp_before_pagebuilder_url_updates', function( $url_map, $options ) {n // Handle infyp_before_pagebuilder_url_updatesn error_log( 'infyp_before_pagebuilder_url_updates: ' . print_r( $url_map, true ) );n}, 10, 2 );
Caching & Performance
infyp_invalidate_all_caches
Fires after all caches are invalidated. @since 1.1.0
Example
add_action( 'infyp_invalidate_all_caches', function( ) {n // Your custom code heren error_log( 'infyp_invalidate_all_caches fired' );n} );
Extensibility Points
infyp_before_uninstall
Fires before the plugin removes its data during uninstall. Extensions should clean up their own data here. @since 1.0.0
Example
add_action( 'infyp_before_uninstall', function( ) {n // Your custom code heren error_log( 'infyp_before_uninstall fired' );n} );
infyp_loaded
Fires after the plugin is fully loaded and all components initialized. @since 1.0.0
Example
add_action( 'infyp_loaded', function( ) {n // Your custom code heren error_log( 'infyp_loaded fired' );n} );
infyp_uninstall_complete
phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching Final cleanup
Example
add_action( 'infyp_uninstall_complete', function( ) {n // Your custom code heren error_log( 'infyp_uninstall_complete fired' );n} );
Total: 41 action hooks
This page documents 41 action hooks available in the free version.