Action and Filter Hooks - alleyinteractive/apple-news GitHub Wiki
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.
apple_news_after_async_push
Optional actions to be taken after an async push completes.
apple_news_after_bulk_export_table
Allows for custom HTML to be printed after the bulk export table.
apple_news_after_clean_up
Actions to be taken after postmeta is cleaned up for a post.
apple_news_after_delete
Actions to be taken after an article is deleted via the API.
apple_news_after_index_table
Allows for custom HTML to be printed after the article list table.
apple_news_after_push
Actions to be taken after an article was pushed to Apple News.
apple_news_after_setting
Allows custom HTML to be printed after the end of an individual setting on the theme edit page.
apple_news_after_setting_group
Allows custom HTML to be printed after the end of a setting group on the theme edit page.
apple_news_after_single_settings
Allows custom HTML to be printed after the publish single article form.
apple_news_before_async_push
Optional actions to be taken before an async push starts.
apple_news_before_bulk_export_table
Allows for custom HTML to be printed before the bulk export table.
apple_news_before_clean_up
Actions to be taken before postmeta is cleaned up for a post.
apple_news_before_delete
Actions to be taken before an article is deleted via the API.
apple_news_before_index_table
Allows for custom HTML to be printed before the article list table.
apple_news_before_push
Actions to be taken before an article is pushed to Apple News.
apple_news_before_setting
Allows custom HTML to be printed before the start of an individual setting on the theme edit page.
apple_news_before_setting_group
Allows custom HTML to be printed before the start of a setting group on the theme edit page.
apple_news_before_single_settings
Allows custom HTML to be printed before the publish single article form.
apple_news_do_fetch_exporter
Actions to be fired before the Exporter class is created and returned.
apple_news_extra_tablenav
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.
apple_news_active_theme
Allows the active theme to be filtered during export on a per-post basis.
apple_news_advertising_settings
Filters the advertisement settings.
apple_news_api_post_meta
Filters custom metadata for the article before being sent to Apple.
apple_news_apply_hanging_punctuation
Allows for modification of a quote with hanging punctuation enabled.
apple_news_author_byline_link
Allows for modification of the byline link used by WordPress authors and CoAuthors Plus.
apple_news_automation_rules
Allows the automation rules to be filtered and set via code.
apple_news_article_metadata
Filters the article metadata.
apple_news_block_editor_is_active
Overrides whether Apple News thinks the block editor is active or not.
apple_news_build_image_src
Allows for an image src value to be filtered before being applied.
apple_news_build_table_html
Allows for table HTML to be filtered before being applied.
apple_news_bulk_actions
Allows you to add, edit or delete available bulk actions on the Apple News list table.
apple_news_bulk_export_capability
Filters the capability required to be able to access the Bulk Export page.
apple_news_bundle_source
Allows for modification of bundle URLs before processing.
apple_news_characters_per_line_anchored
Allows for filtering of the estimated characters per line.
apple_news_column_default
Filters the default value for a column in the article list table.
apple_news_column_title
Filters the HTML of the title column in the article list table.
apple_news_{$component_name}_html_enabled
Lets themes and plugins override HTML settings for a component.
apple_news_{$component_name}_json
Filters the final JSON for a specific component.
apple_news_component_layouts
Modifies available component layouts.
apple_news_component_styles
Modifies available component styles.
apple_news_component_text_styles
Modifies available component text styles.
apple_news_content_settings
Filters the Exporter_Content_Settings object for this article.
apple_news_delete_capability
Filters the delete capability required to delete posts from Apple News.
apple_news_dropcap
Filters the dropcap content.
apple_news_export_list_columns
Allows you to add, edit or delete the columns on the Apple News list table.
apple_news_export_table_get_posts_args
Allows you to manipulate the $args sent to WP_Query to populate the posts on the Apple News list table.
apple_news_export_table_pagination_args
Allows you to manipulate the arguments for paginating the Apple News list table.
apple_news_exporter_byline
Filters the byline of an article before it is sent to Apple News.
apple_news_exporter_content
Filters the HTML of a post after the_content filter is called, but before the HTML is parsed into Apple News Format.
apple_news_exporter_content_pre
Filters the HTML of a post before the_content filter is called, and before the HTML is parsed into Apple News Format.
apple_news_exporter_cover_caption
Filters the cover caption.
apple_news_exporter_cover_url
Filters the URL to the cover media of an article before it is sent to Apple News.
apple_news_exporter_excerpt
Filters the excerpt of an article before it is sent to Apple News.
apple_news_exporter_language
Filters the language of the article.
apple_news_exporter_post_thumb
Filters the cover image URL of an article before it is sent to Apple News.
apple_news_exporter_slug
Filters the slug of an article before it is sent to Apple News.
apple_news_exporter_title
Filters the title of an article before it is sent to Apple News.
apple_news_field_description_output_html
Modifies the HTML output for the description of any field.
apple_news_fonts_list
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.
apple_news_generate_json
Filters the final article JSON before being sent to Apple News.
apple_news_get_bundles
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.
apple_news_get_errors
Modifies the list of errors encountered during publishing.
apple_news_get_json
Similar to apple_news_generate_json, but modifies the JSON as it's retrieved from the workspace.
apple_news_get_sections_for_post
Filters the sections for a post.
apple_news_initialize_components
Allows you to add custom component classes to the plugin.
apple_news_is_post_in_sync
Allows for custom logic to determine if a post is in sync or not.
apple_news_json_editor_ace_theme
Modifies the JSON editor theme.
apple_news_layout
Modifies the layout settings from the Apple News formatting options.
apple_news_list_capability
Modifies the capability required to view the list of Apple News articles.
apple_news_loaded_settings
Allows for filtering of the merged settings before returning.
apple_news_markdown_hyperlink
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.
apple_news_metadata
Modifies the metadata for a post.
apple_news_notice_message
Allows you to change any success, info, or error notice that appears in the dashboard.
apple_news_notification_headers
Add headers (such as From:) to notification messages.
apple_news_parse_html
Allows for filtering of the formatted content before return.
apple_news_parse_markdown
Allows for filtering of the formatted content before return.
apple_news_post_status_cache_expiration
Filters the cache lifetime for API responses.
apple_news_post_types
Modifies the post types available for selection on the settings page.
apple_news_postmeta_json_token
Allows for filtering a postmeta value used in Apple News JSON.
apple_news_publish_capability
Filters the publish capability required to publish posts to Apple News.
apple_news_publish_meta_box_context
Changes the context (i.e. column) where the Apple News meta box appears by default on the post edit screen. Defaults to 'side'.
apple_news_publish_meta_box_priority
Changes the priority (i.e. vertical location) where the Apple News meta box appears by default on the post edit screen. Defaults to 'high'.
apple_news_publish_statuses
Filters the list of publish statuses available in the article list table.
apple_news_recipe_schema_permalink
Filters the URL for an article that will be fetched and searched for JSON-LD Recipe items.
apple_news_register_component
Allows you to modify a specific component class before it's registered.
apple_news_request_args
Sets the default arguments for requests of any type.
apple_news_section_groups
Modifies the groups for the settings page.
apple_news_section_settings
Modifies the setting values for the settings page.
apple_news_section_taxonomy
Allows for modification of the taxonomy used for section mapping.
apple_news_settings_capability
Modifies the capability required to edit Apple News settings. Defaults to manage_options.
apple_news_settings_sections
Modifies the available sections on the settings page.
apple_news_should_post_autopublish
Ability to override the autopublishing of posts on a per-post level.
apple_news_should_post_delete_on_trash
Determines whether to delete an article via the Apple News API if it is moved from publish status to the trash in WordPress.
apple_news_should_post_delete_on_unpublish
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).
apple_news_skip_push
Filters whether the post should be skipped and not pushed to Apple News.
apple_news_skip_push_term_ids
Filters whether the post should be skipped and not pushed to Apple News based on taxonomy term IDs that are associated with the post.
apple_news_text_styles
Allows for filtering of global text styles.
apple_news_{$verb}_args
Allow filtering of the default arguments for the request.
apple_news_write_json
Similar to apple_news_generate_json, but modifies the JSON before it's written to the workspace.