Web Stories icon
Utilities

Web Stories hooks reference

  • By Google
  • v1.42.0
  • Updated

Web Stories 1.42.0 has 6 actions and 59 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.

functions.phpyour child theme
// Run your own code when Web Stories fires an action
add_action( 'web_stories_activation', function( $network_wide ) {
	// Your code runs here.
}, 10, 1 );

// Change a value Web Stories is about to use
add_filter( 'wp_check_post_lock_window', 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

  • includes/REST_API/Stories_Controller.php line 622 · used in 3 places
    /**
     * This filter is documented in wp-admin/includes/ajax-actions.php
     */
    apply_filters( 'wp_check_post_lock_window', 150 );
  • includes/REST_API/Stories_Base_Controller.php line 156 · used in 2 places
    /**
     * This filter is documented in
     * wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
     */
    apply_filters( "rest_prepare_{$this->post_type}", $response, $post, $request );
  • includes/AMP/Sanitization.php line 125 · used in 2 places
    /**
     * Filters whether the validation error should be sanitized.
     */
    apply_filters( 'web_stories_amp_validation_error_sanitized', true, $error );
  • includes/Admin/Dashboard.php line 247 · used in 2 places
    /**
     * This filter is documented in includes/Admin/Dashboard.php
     */
    apply_filters( 'web_stories_dashboard_settings', $settings );
  • includes/REST_API/Hotlinking_Controller.php line 813
    /**
     * This filter is documented in wp-includes/http.php
     */
    apply_filters( 'http_allowed_safe_ports', [ 80, 443, 8080 ], $host, $url );
  • includes/Renderer/Oembed.php line 153
    /**
     * This filter is documented in wp-includes/embed.php
     */
    apply_filters( 'oembed_min_max_width', [ 'min' => 200, 'max' => 360, ] );
  • includes/Post_Type_Base.php line 351
    /**
     * This filter is documented in wp-includes/link-template.php
     */
    apply_filters( 'post_type_archive_link', $link, $this->get_slug() );
  • includes/REST_API/Font_Controller.php line 369
    /**
     * This filter is documented in
     * wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
     */
    apply_filters( "rest_{$this->post_type}_collection_params", $query_params, $this->post_type );
  • includes/REST_API/Stories_Lock_Controller.php line 359
    /**
     * Filters the lock data for a response.
     */
    apply_filters( "rest_prepare_{$post_type}_lock", $response, $item, $request );
  • includes/REST_API/Stories_Autosaves_Controller.php line 167
    /**
     * This filter is documented in
     * wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php
     */
    apply_filters( 'rest_prepare_autosave', $response, $post, $request );
  • includes/Story_Revisions.php line 178
    /**
     * This filter is documented in wp-admin/includes/revision.php
     */
    apply_filters( 'revision_text_diff_options', $args, 'post_content', $compare_from, $compare_to );
  • includes/Admin/Editor.php line 378
    /**
     * This filter is documented in wp-admin/includes/post.php
     */
    apply_filters( 'show_post_locked_dialog', true, $post, $user );
  • includes/Renderer/Stories/Generic_Renderer.php line 110
    /**
     * Filters the Generic renderer stories content.
     */
    apply_filters( "web_stories_{$view_type}_renderer_stories_content", $content );
  • includes/namespace.php line 56
    /**
     * Fires after plugin activation.
     */
    do_action( 'web_stories_activation', $network_wide );
  • includes/Ad_Manager.php line 106
    /**
     * Filters Google Ad Manager configuration passed to `<amp-story-auto-ads>`.
     */
    apply_filters( 'web_stories_ad_manager_configuration', $configuration, $slot );
  • includes/User/Capabilities.php line 172
    /**
     * Fires when adding the custom capabilities to existing roles.
     */
    do_action( 'web_stories_add_capabilities', $all_capabilities );
  • includes/Media/Types.php line 98
    /**
     * Filter list of allowed mime types.
     */
    apply_filters( 'web_stories_allowed_mime_types', $default_allowed_mime_types );
  • includes/AMP/Sanitization.php line 507
    /**
     * Filters the XPath queries for elements that should be enabled for dev mode.
     */
    apply_filters( 'web_stories_amp_dev_mode_element_xpaths', [] );
  • includes/AMP/Sanitization.php line 410
    /**
     * Filters whether AMP dev mode is enabled.
     */
    apply_filters( 'web_stories_amp_dev_mode_enabled', $dev_mode_enabled );
  • includes/AMP/Optimization.php line 182
    /**
     * Filter the configuration to be used for the AMP Optimizer.
     */
    apply_filters( 'web_stories_amp_optimizer_config', $configuration );
  • includes/AMP/Sanitization.php line 493
    /**
     * Filters the content sanitizers.
     */
    apply_filters( 'web_stories_amp_sanitizers', $sanitizers );
  • includes/Analytics.php line 234
    /**
     * Filters the Web Stories Google Analytics configuration.
     */
    apply_filters( 'web_stories_analytics_configuration', $config );
  • includes/Block/Web_Stories_Block.php line 367
    /**
     * Filters settings passed to the web stories block.
     */
    apply_filters( 'web_stories_block_settings', $settings );
  • includes/Admin/Dashboard.php line 404
    /**
     * Preload common data by specifying an array of REST API paths that will be
     * preloaded.
     */
    apply_filters( 'web_stories_dashboard_preload_paths', $preload_paths );
  • includes/namespace.php line 131
    /**
     * Fires after plugin deactivation.
     */
    do_action( 'web_stories_deactivation', $network_wide );
  • includes/Renderer/Stories/FieldStateFactory/Factory.php line 119
    /**
     * Filters the field state object.
     */
    apply_filters( 'web_stories_default_field_state', $default_field_state );
  • includes/Admin/Meta_Boxes.php line 160
    /**
     * Filters meta box data before making it available to the editor.
     */
    apply_filters( 'web_stories_editor_meta_boxes', $_wp_meta_boxes );
  • includes/templates/admin/edit-story.php line 153
    /**
     * Preload common data by specifying an array of REST API paths that will be
     * preloaded.
     */
    apply_filters( 'web_stories_editor_preload_paths', $preload_paths, $post );
  • includes/Admin/Editor.php line 494
    /**
     * Filters settings passed to the web stories editor.
     */
    apply_filters( 'web_stories_editor_settings', $settings );
  • includes/REST_API/Embed_Controller.php line 157
    /**
     * Filters the link data TTL value.
     */
    apply_filters( 'web_stories_embed_data_cache_ttl', DAY_IN_SECONDS, $url );
  • includes/REST_API/Embed_Controller.php line 218
    /**
     * Filters the HTTP request args for link data retrieval.
     */
    apply_filters( 'web_stories_embed_data_request_args', $args, $url );
  • includes/Embed_Base.php line 217
    /**
     * Filters settings passed to the web stories embed.
     */
    apply_filters( 'web_stories_embed_default_attributes', $attrs );
  • includes/Decoder.php line 52
    /**
     * Filter whether the encoding requests.
     */
    apply_filters( 'web_stories_enable_decoding', true );
  • includes/Discovery.php line 123
    /**
     * Filters whether to print the document title.
     */
    apply_filters( 'web_stories_enable_document_title', true );
  • includes/Discovery.php line 151
    /**
     * Filters whether to print the meta description.
     */
    apply_filters( 'web_stories_enable_metadata', true );
  • includes/Discovery.php line 197
    /**
     * Filters filter to enable / disable open graph metadata.
     */
    apply_filters( 'web_stories_enable_open_graph_metadata', true );
  • includes/Discovery.php line 173
    /**
     * Filters filter to enable / disable schemaorg metadata.
     */
    apply_filters( 'web_stories_enable_schemaorg_metadata', true );
  • includes/AMP/Optimization.php line 146
    /**
     * Filter whether the AMP Optimizer should use server-side rendering or not.
     */
    apply_filters( 'web_stories_enable_ssr', true );
  • includes/Discovery.php line 222
    /**
     * Filters filter to enable / disable twitter metadata.
     */
    apply_filters( 'web_stories_enable_twitter_metadata', true );
  • uninstall.php line 77
    /**
     * Filters whether data should be erased when uninstalling the plugin.
     */
    apply_filters( 'web_stories_erase_data_on_uninstall', $erase );
  • includes/Media/Media_Source_Taxonomy.php line 370
    /**
     * Filter whether generated attachments should be hidden in the media library.
     */
    apply_filters( 'web_stories_hide_auto_generated_attachments', true, $args );
  • includes/REST_API/Hotlinking_Controller.php line 239
    /**
     * Filters the hotlinking data TTL value.
     */
    apply_filters( 'web_stories_hotlinking_url_data_cache_ttl', DAY_IN_SECONDS, $raw_url );
  • includes/Mgid.php line 106
    /**
     * Filters MGID configuration passed to `<amp-story-auto-ads>`.
     */
    apply_filters( 'web_stories_mgid_configuration', $configuration, $widget );
  • includes/Renderer/Story/HTML.php line 216
    /**
     * Fires before the closing <amp-story> tag.
     */
    do_action( 'web_stories_print_analytics' );
  • includes/Model/Story.php line 415
    /**
     * Filters the publisher logo size.
     */
    apply_filters( 'web_stories_publisher_logo_size', $this->publisher_logo_size, $this->id );
  • includes/Model/Story.php line 156
    /**
     * Filters the publisher's name
     */
    apply_filters( 'web_stories_publisher_name', get_bloginfo( 'name' ) );
  • includes/User/Capabilities.php line 204
    /**
     * Fires when removing the custom capabilities from existing roles.
     */
    do_action( 'web_stories_remove_capabilities', $all_capabilities );
  • includes/Renderer/Stories/Renderer.php line 635
    /**
     * Filters the web stories renderer single story classes.
     */
    apply_filters( 'web_stories_renderer_container_styles', $story_styles );
  • includes/Renderer/Stories/Renderer.php line 612
    /**
     * Filters the web stories renderer single story classes.
     */
    apply_filters( 'web_stories_renderer_single_story_classes', $classes );
  • includes/REST_API/Stories_Media_Controller.php line 378
    /**
     * Filters WP_Query arguments when querying posts via the REST API.
     */
    apply_filters( 'web_stories_rest_attachment_query', $query_args, $request );
  • includes/REST_API/Stories_Media_Controller.php line 253
    /**
     * Filters an attachment returned from the REST API.
     */
    apply_filters( 'web_stories_rest_prepare_attachment', $response, $post, $request );
  • includes/Renderer/Story/HTML.php line 255
    /**
     * Filters the list of sharing providers in the Web Stories sharing dialog.
     */
    apply_filters( 'web_stories_share_providers', $share_providers );
  • includes/Shopping/Shopify_Query.php line 328
    /**
     * Filters the Shopify products data TTL value.
     */
    apply_filters( 'web_stories_shopify_data_cache_ttl', 5 * MINUTE_IN_SECONDS );
  • includes/Shopping/Shopping_Vendors.php line 111
    /**
     * Filter the array of vendors.
     */
    apply_filters( 'web_stories_shopping_vendors', $vendors );
  • includes/Renderer/Story/HTML.php line 167
    /**
     * Prints scripts or data in the head tag on the front end.
     */
    do_action( 'web_stories_story_head' );
  • includes/Discovery.php line 479
    /**
     * Filters the open graph metadata for a given story.
     */
    apply_filters( 'web_stories_story_open_graph_metadata', $metadata, $post );
  • includes/Discovery.php line 372
    /**
     * Filters the schema.org metadata for a given story.
     */
    apply_filters( 'web_stories_story_schema_metadata', $metadata, $post );
  • includes/Discovery.php line 519
    /**
     * Filters the twitter metadata for a given story.
     */
    apply_filters( 'web_stories_story_twitter_metadata', $metadata, $post );
  • widget_title

    filter
    includes/Widgets/Stories.php line 128
    /**
     * This filter is documented in wp-includes/widgets/class-wp-widget-pages.php
     */
    apply_filters( 'widget_title', $title, $instance, $this->id_base );

Generated from Web Stories's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.

Can't find the right hook?

We can build the customisation for you. Describe what you need: