Skip to content

Action and Filter Hooks

Brendan Huffman edited this page Feb 15, 2023 · 57 revisions

There are numerous action and filter hooks throughout the plugin to allow for advanced users to customize virtually any aspect of the article before it's sent to Apple News. Many larger publishers have used these hooks to create detailed custom templates or modify the post content specifically for Apple News. If you're unfamiliar with hooks in WordPress, the core documentation on actions and filters is a great place to start.

We're providing documentation here on these hooks so everyone is aware of what's available, but as always it's best to view them in the source code and see them in action if you need more clarity on how they can be used. We've listed all hooks below alphabetically, but if you click through for more details on a hook, there is a link to the source file to make it easy for you to find them if needed.

Action hooks

Action hooks are used to trigger custom functions that rely on knowing when a specific piece of code executes or to insert additional content on template pages. They sometimes are accompanied by parameters that are relevant to the specific action. Click on the name of an action hook for more information about that specific hook.

Optional actions to be taken after an async push completes.

Allows for custom HTML to be printed after the bulk export table.

Actions to be taken after postmeta is cleaned up for a post.

Actions to be taken after an article is deleted via the API.

Allows for custom HTML to be printed after the article list table.

Actions to be taken after an article was pushed to Apple News.

Allows custom HTML to be printed after the end of an individual setting on the theme edit page.

Allows custom HTML to be printed after the end of a setting group on the theme edit page.

Allows custom HTML to be printed after the publish single article form.

Optional actions to be taken before an async push starts.

Allows for custom HTML to be printed before the bulk export table.

Actions to be taken before postmeta is cleaned up for a post.

Actions to be taken before an article is deleted via the API.

Allows for custom HTML to be printed before the article list table.

Actions to be taken before an article is pushed to Apple News.

Allows custom HTML to be printed before the start of an individual setting on the theme edit page.

Allows custom HTML to be printed before the start of a setting group on the theme edit page.

Allows custom HTML to be printed before the publish single article form.

Actions to be fired before the Exporter class is created and returned.

Allows theme and plugin authors to add additional Apple News list table filters.

Filter hooks

Filter hooks are used to modify a variable. The first parameter is always the data to be modified and additional parameters may also be provided that are relevant to that specific filter. If you're hooking a filter your function must return the data, even if unmodified, or it will simply delete the value. Click on the name of a filter hook for more information about that specific hook.

Filters the active theme.

Filters the advertisement settings.

Filters custom metadata for the article before being sent to Apple.

Allows for modification of a quote with hanging punctuation enabled.

Allows for modification of the byline link used by WordPress authors and CoAuthors Plus.

Overrides whether Apple News thinks the block editor is active or not.

Allows for an image src value to be filtered before being applied.

Allows for table HTML to be filtered before being applied.

Allows you to add, edit or delete available bulk actions on the Apple News list table.

Filters the capability required to be able to access the Bulk Export page.

Allows for modification of bundle URLs before processing.

Allows for filtering of the estimated characters per line.

Filters the default value for a column in the article list table.

Filters the HTML of the title column in the article list table.

Lets themes and plugins override HTML settings for a component.

Filters the final JSON for a specific component.

Modifies available component layouts.

Modifies available component styles.

Modifies available component text styles.

Filters the Exporter_Content_Settings object for this article.

Filters the delete capability required to delete posts from Apple News.

Allows you to add, edit or delete the columns on the Apple News list table.

Allows you to manipulate the $args sent to WP_Query to populate the posts on the Apple News list table.

Allows you to manipulate the arguments for paginating the Apple News list table.

Filters the byline of an article before it is sent to Apple News.

Filters the HTML of a post after the_content filter is called, but before the HTML is parsed into Apple News Format.

Filters the HTML of a post before the_content filter is called, and before the HTML is parsed into Apple News Format.

Filters the cover caption.

Filters the excerpt of an article before it is sent to Apple News.

Filters the language of the article.

Filters the cover image URL of an article before it is sent to Apple News.

Filters the slug of an article before it is sent to Apple News.

Filters the title of an article before it is sent to Apple News.

Modifies the HTML output for the description of any field.

Allows the font list to be filtered, so that any custom fonts that have been approved by Apple and added to your channel will be able to be added to the list for selection.

Filters the final article JSON before being sent to Apple News.

Modifies the list of bundled assets. This is an array of images that were located in the post and need to be sent to Apple News.

Modifies the list of errors encountered during publishing.

Similar to apple_news_generate_json, but modifies the JSON as it's retrieved from the workspace.

Filters the sections for a post.

Allows you to add custom component classes to the plugin.

Allows for custom logic to determine if a post is in sync or not.

Modifies the JSON editor theme.

Modifies the layout settings from the Apple News formatting options.

Modifies the capability required to view the list of Apple News articles.

Allows for filtering of the merged settings before returning.

Modifies the URL for a specific hyperlink if for some reason it needed to be reformatted for Apple News, such as to add tracking parameters to track traffic originating from Apple News.

Modifies the metadata for a post.

Allows you to change any success, info, or error notice that appears in the dashboard.

Add headers (such as From:) to notification messages.

Allows for filtering of the formatted content before return.

Allows for filtering of the formatted content before return.

Filters the cache lifetime for API responses.

Modifies the post types available for selection on the settings page.

Allows for filtering a postmeta value used in Apple News JSON.

Filters the publish capability required to publish posts to Apple News.

Changes the context (i.e. column) where the Apple News meta box appears by default on the post edit screen. Defaults to 'side'.

Changes the priority (i.e. vertical location) where the Apple News meta box appears by default on the post edit screen. Defaults to 'high'.

Filters the list of publish statuses available in the article list table.

Allows you to modify a specific component class before it's registered.

Sets the default arguments for requests of any type.

Modifies the groups for the settings page.

Modifies the setting values for the settings page.

Allows for modification of the taxonomy used for section mapping.

Modifies the capability required to edit Apple News settings. Defaults to manage_options.

Modifies the available sections on the settings page.

Ability to override the autopublishing of posts on a per-post level.

Determines whether to delete an article via the Apple News API if it is moved from publish status to the trash in WordPress.

Determines whether to delete an article via the Apple News API if it is unpublished in WordPress (defined as moving a post from the publish status to any other status, including trash).

Filters whether the post should be skipped and not pushed to Apple News.

Filters whether the post should be skipped and not pushed to Apple News based on taxonomy term IDs that are associated with the post.

Allows for filtering of global text styles.

Allow filtering of the default arguments for the request.

Similar to apple_news_generate_json, but modifies the JSON before it's written to the workspace.

Clone this wiki locally