Documentation Index Fetch the complete documentation index at: https://mintlify.com/GoogleForCreators/web-stories-wp/llms.txt
Use this file to discover all available pages before exploring further.
The Web Stories plugin provides numerous filter hooks that allow you to modify data, settings, and behavior throughout the plugin. Filter hooks let you intercept and modify values before they’re used.
Story Metadata & Discovery
web_stories_enable_document_title
Controls whether the document title is printed in the story head. Whether to print the document title
add_filter ( 'web_stories_enable_document_title' , function ( $enable ) {
// Disable document title for stories
return false ;
} );
Location: includes/Discovery.php:123
web_stories_enable_metadata
web_stories_enable_schemaorg_metadata
web_stories_enable_open_graph_metadata
web_stories_enable_twitter_metadata
web_stories_story_schema_metadata
Filters the Schema.org structured data for a story. The structured data array
The current post object if available
add_filter ( 'web_stories_story_schema_metadata' , function ( $metadata , $post ) {
// Add custom schema properties
$metadata [ 'keywords' ] = get_post_meta ( $post -> ID , 'story_keywords' , true );
$metadata [ 'author' ][ 'url' ] = get_author_posts_url ( $post -> post_author );
return $metadata ;
}, 10 , 2 );
Location: includes/Discovery.php:372
web_stories_story_open_graph_metadata
Filters the Open Graph metadata array for a story. Array of Open Graph meta tags
add_filter ( 'web_stories_story_open_graph_metadata' , function ( $metadata , $post ) {
// Add custom Open Graph tags
$metadata [ 'og:video' ] = get_post_meta ( $post -> ID , 'story_video_url' , true );
$metadata [ 'og:locale' ] = get_locale ();
return $metadata ;
}, 10 , 2 );
Location: includes/Discovery.php:479
web_stories_story_twitter_metadata
Publisher & Branding
web_stories_publisher_name
Filters the publisher name displayed in stories. $name
string
default: "get_bloginfo('name')"
The publisher name
add_filter ( 'web_stories_publisher_name' , function ( $name ) {
return 'My Custom Publisher Name' ;
} );
Location: includes/Model/Story.php:156
web_stories_publisher_logo
Filters the publisher logo URL for a story. add_filter ( 'web_stories_publisher_logo' , function ( $logo , $story_id ) {
// Use a different logo for certain stories
$custom_logo = get_post_meta ( $story_id , 'custom_publisher_logo' , true );
return $custom_logo ? $custom_logo : $logo ;
}, 10 , 2 );
Location: includes/Model/Story.php:380
web_stories_publisher_logo_size
Filters the publisher logo size (width and height) for a story. Array containing width and height [width, height]
add_filter ( 'web_stories_publisher_logo_size' , function ( $size , $story_id ) {
// Ensure minimum dimensions
if ( $size [ 0 ] < 96 ) {
return [ 96 , 96 ];
}
return $size ;
}, 10 , 2 );
Location: includes/Model/Story.php:415
Story Rendering & Display
web_stories_share_providers
Filters the list of sharing providers in the story sharing dialog. Array of sharing provider configurations
add_filter ( 'web_stories_share_providers' , function ( $providers ) {
// Add WhatsApp sharing
$providers [] = [
'provider' => 'whatsapp' ,
];
// Add custom sharing option
$providers [] = [
'provider' => 'custom' ,
'shareEndpoint' => 'https://example.com/share' ,
];
return $providers ;
} );
Location: includes/Renderer/Story/HTML.php:255
web_stories_renderer_single_story_classes
Filters the CSS classes applied to a single story container. add_filter ( 'web_stories_renderer_single_story_classes' , function ( $classes ) {
$classes [] = 'my-custom-story-class' ;
if ( is_user_logged_in () ) {
$classes [] = 'user-logged-in' ;
}
return $classes ;
} );
Location: includes/Renderer/Stories/Renderer.php:612
web_stories_renderer_container_styles
Filters the inline styles applied to the story container. Array of CSS property => value pairs
add_filter ( 'web_stories_renderer_container_styles' , function ( $styles ) {
// Add custom container styles
$styles [ 'max-width' ] = '800px' ;
$styles [ 'margin' ] = '0 auto' ;
return $styles ;
} );
Location: includes/Renderer/Stories/Renderer.php:635
web_stories_renderer_link_attributes
Filters the HTML attributes for story links in listings. Position in the story list
The view type (e.g., ‘carousel’, ‘grid’)
add_filter ( 'web_stories_renderer_link_attributes' , function ( $attributes , $story , $position , $view_type ) {
// Add data attributes for tracking
$attributes [ 'data-story-id' ] = $story -> get_id ();
$attributes [ 'data-position' ] = $position ;
$attributes [ 'data-view-type' ] = $view_type ;
// Add custom class
$attributes [ 'class' ] = 'custom-story-link' ;
return $attributes ;
}, 10 , 4 );
Location: includes/Renderer/Stories/Renderer.php:726
web_stories_carousel_renderer_stories_content
Filters the HTML content for the carousel renderer. The rendered HTML content
add_filter ( 'web_stories_carousel_renderer_stories_content' , function ( $content ) {
// Wrap carousel in custom container
return '<div class="my-carousel-wrapper">' . $content . '</div>' ;
} );
Location: includes/Renderer/Stories/Carousel_Renderer.php:166
Editor & Dashboard
web_stories_editor_settings
Filters the settings passed to the story editor. add_filter ( 'web_stories_editor_settings' , function ( $settings ) {
// Customize editor settings
$settings [ 'capabilities' ][ 'canUploadFiles' ] = current_user_can ( 'upload_files' );
$settings [ 'features' ][ 'customFeature' ] = true ;
return $settings ;
} );
Location: includes/Admin/Editor.php:494
web_stories_editor_preload_paths
Filters the REST API paths to preload in the editor. Array of REST API endpoint paths
add_filter ( 'web_stories_editor_preload_paths' , function ( $preload_paths , $post ) {
// Add custom endpoint to preload
$preload_paths [] = '/wp/v2/my-custom-endpoint' ;
return $preload_paths ;
}, 10 , 2 );
Location: includes/templates/admin/edit-story.php:153
web_stories_editor_meta_boxes
web_stories_dashboard_settings
Filters the settings passed to the stories dashboard. Array of dashboard settings
add_filter ( 'web_stories_dashboard_settings' , function ( $settings ) {
// Customize dashboard settings
$settings [ 'customDashboardOption' ] = true ;
$settings [ 'features' ][ 'beta' ] = current_user_can ( 'manage_options' );
return $settings ;
} );
Location: includes/Admin/Dashboard.php:247
web_stories_dashboard_preload_paths
Filters the REST API paths to preload in the dashboard. Array of REST API endpoint paths
add_filter ( 'web_stories_dashboard_preload_paths' , function ( $preload_paths ) {
// Preload additional data in dashboard
$preload_paths [] = '/web-stories/v1/custom-data' ;
return $preload_paths ;
} );
Location: includes/Admin/Dashboard.php:404
Analytics & Ads
web_stories_analytics_configuration
Filters the Google Analytics configuration for stories. Analytics configuration array
add_filter ( 'web_stories_analytics_configuration' , function ( $config ) {
// Add custom analytics events
$config [ 'triggers' ][ 'customEvent' ] = [
'on' => 'story-page-visible' ,
'request' => 'event' ,
'vars' => [
'event_name' => 'custom_tracking' ,
'event_category' => 'web_stories' ,
],
];
return $config ;
} );
Location: includes/Analytics.php:234
web_stories_ad_manager_configuration
Filters the Google Ad Manager configuration. add_filter ( 'web_stories_ad_manager_configuration' , function ( $config , $slot ) {
// Customize ad configuration
$config [ 'targeting' ] = [
'category' => 'web-stories' ,
];
return $config ;
}, 10 , 2 );
Location: includes/Ad_Manager.php:106
web_stories_mgid_configuration
Filters the Mgid ad widget configuration. add_filter ( 'web_stories_mgid_configuration' , function ( $config , $widget ) {
// Customize Mgid configuration
return $config ;
}, 10 , 2 );
Location: includes/Mgid.php:106
web_stories_allowed_mime_types
Filters the list of allowed MIME types for story media. Array of allowed MIME types
add_filter ( 'web_stories_allowed_mime_types' , function ( $mime_types ) {
// Add WebP support
$mime_types [ 'image/webp' ] = [
'image/webp' ,
];
// Add additional video format
$mime_types [ 'video/webm' ] = [
'video/webm' ,
];
return $mime_types ;
} );
Location: includes/Media/Types.php:98
web_stories_hide_auto_generated_attachments
Controls whether auto-generated media attachments are hidden from the media library. Whether to hide auto-generated attachments
add_filter ( 'web_stories_hide_auto_generated_attachments' , function ( $enabled , $args ) {
// Show all attachments for administrators
if ( current_user_can ( 'manage_options' ) ) {
return false ;
}
return $enabled ;
}, 10 , 2 );
Location: includes/Media/Media_Source_Taxonomy.php:370
REST API
web_stories_rest_prepare_attachment
Filters the attachment response from the REST API. add_filter ( 'web_stories_rest_prepare_attachment' , function ( $response , $post , $request ) {
// Add custom data to attachment response
$data = $response -> get_data ();
$data [ 'custom_field' ] = get_post_meta ( $post -> ID , 'custom_field' , true );
$response -> set_data ( $data );
return $response ;
}, 10 , 3 );
Location: includes/REST_API/Stories_Media_Controller.php:253
web_stories_rest_attachment_query
Filters the attachment query arguments in the REST API. add_filter ( 'web_stories_rest_attachment_query' , function ( $args , $request ) {
// Modify query to only show approved media
$args [ 'meta_query' ][] = [
'key' => 'media_approved' ,
'value' => '1' ,
];
return $args ;
}, 10 , 2 );
Location: includes/REST_API/Stories_Media_Controller.php:378
web_stories_embed_data_cache_ttl
Filters the cache TTL for embed data. $ttl
int
default: "DAY_IN_SECONDS"
Cache time-to-live in seconds
add_filter ( 'web_stories_embed_data_cache_ttl' , function ( $ttl , $url ) {
// Cache for 1 hour instead of 1 day
return HOUR_IN_SECONDS ;
}, 10 , 2 );
Location: includes/REST_API/Embed_Controller.php:157
web_stories_link_data_cache_ttl
Filters the cache TTL for link metadata. $ttl
int
default: "DAY_IN_SECONDS"
Cache time-to-live in seconds
add_filter ( 'web_stories_link_data_cache_ttl' , function ( $ttl , $url ) {
return WEEK_IN_SECONDS ;
}, 10 , 2 );
Location: includes/REST_API/Link_Controller.php:151
AMP & Optimization
Controls whether server-side rendering is enabled for AMP optimization. add_filter ( 'web_stories_enable_ssr' , '__return_false' );
Location: includes/AMP/Optimization.php:146
web_stories_amp_optimizer_config
Filters the AMP Optimizer configuration. AMP Optimizer configuration array
add_filter ( 'web_stories_amp_optimizer_config' , function ( $config ) {
// Customize AMP optimization
$config [ 'transformations' ] = [ 'YOUR_CUSTOM_TRANSFORMATION' ];
return $config ;
} );
Location: includes/AMP/Optimization.php:182
web_stories_amp_sanitizers
Filters the list of AMP sanitizers. Array of sanitizer class names and configurations
add_filter ( 'web_stories_amp_sanitizers' , function ( $sanitizers ) {
// Add custom sanitizer
$sanitizers [ 'My_Custom_Sanitizer' ] = [];
return $sanitizers ;
} );
Location: includes/AMP/Sanitization.php:493
web_stories_amp_dev_mode_enabled
Controls whether AMP dev mode is enabled. Whether dev mode is enabled
add_filter ( 'web_stories_amp_dev_mode_enabled' , function ( $enabled ) {
// Enable dev mode for developers
return current_user_can ( 'manage_options' );
} );
Location: includes/AMP/Sanitization.php:410
web_stories_amp_validation_error_sanitized
Filters whether an AMP validation error should be sanitized. Whether the error is sanitized
add_filter ( 'web_stories_amp_validation_error_sanitized' , function ( $sanitized , $error ) {
// Log validation errors in development
if ( WP_DEBUG ) {
error_log ( print_r ( $error , true ) );
}
return $sanitized ;
}, 10 , 2 );
Location: includes/AMP/Sanitization.php:125
web_stories_enable_decoding
Controls whether HTML decoding is enabled for story content. Whether to enable decoding
add_filter ( 'web_stories_enable_decoding' , '__return_false' );
Location: includes/Decoder.php:52
Blocks & Embeds
web_stories_block_settings
Filters the settings for the Web Stories Gutenberg block. add_filter ( 'web_stories_block_settings' , function ( $settings ) {
// Customize block settings
$settings [ 'defaultAttributes' ][ 'numOfStories' ] = 5 ;
return $settings ;
} );
Location: includes/Block/Web_Stories_Block.php:367
web_stories_embed_default_attributes
Filters the default attributes for story embeds. add_filter ( 'web_stories_embed_default_attributes' , function ( $attrs ) {
// Set default embed width
$attrs [ 'width' ] = 600 ;
$attrs [ 'height' ] = 800 ;
return $attrs ;
} );
Location: includes/Embed_Base.php:217
web_stories_shopping_vendors
web_stories_shopify_data_cache_ttl
Filters the cache TTL for Shopify product data. $ttl
int
default: "5 * MINUTE_IN_SECONDS"
Cache time-to-live in seconds
add_filter ( 'web_stories_shopify_data_cache_ttl' , function ( $ttl ) {
return 10 * MINUTE_IN_SECONDS ;
} );
Location: includes/Shopping/Shopify_Query.php:328
Action Hooks Explore action hooks for executing custom code
Custom Post Types Learn about custom post types in the plugin