Project

General

Profile

Filter and Action Hooks

Note: this list is incomplete and needs updating

Filter Hooks

Add-Meta-Tags allows filtering of the generated metatags and also of some core functionality through filters. This way advanced customization of the plugin is possible.

Add-Meta-Tags generates metadata that is used in the head area of the HTML page or embedded in the body (wrapped around the content or in the footer area).

The available filters are:

Post object filtering

amt_get_queried_object

Applied to the post object and lets you modify it or use an alternative post object. The hooked function should accept and return 1 argument: a post object.

Metadata filtering

amt_metadata_head

Applied to all metatags that have been generated by Add-Meta-Tags for the head area of the HTML page. The hooked function should accept and return 1 argument: An array of meta tags.

amt_metadata_footer

Applied to all metatags that have been generated by Add-Meta-Tags for the footer area of the HTML page. The hooked function should accept and return 1 argument: An array of meta tags.

amt_basic_metadata_head

Applied to the basic metatags (description, keywords, etc) that have been generated by Add-Meta-Tags for the head area of the HTML page. The hooked function should accept and return 1 argument: An array of meta tags.

amt_opengraph_metadata_head

Applied to the OpenGraph metatags that have been generated by Add-Meta-Tags for the head area of the HTML page. The hooked function should accept and return 1 argument: An array of meta tags.

amt_twitter_cards_metadata_head

Applied to the Twitter Cards metatags that have been generated by Add-Meta-Tags for the head area of the HTML page. The hooked function should accept and return 1 argument: An array of meta tags.

amt_dublin_core_metadata_head

Applied to the Dublin Core metatags that have been generated by Add-Meta-Tags for the head area of the HTML page. The hooked function should accept and return 1 argument: An array of meta tags.

amt_dublin_core_license

Applied to the URL of the license that is used by the Dublin Core metadata generator. The hooked function should accept and return 1 argument
A string. The hooked function can also accept the post ID as a second optional argument.

amt_schemaorg_metadata_head

Applied to the 'author' and 'publisher' links in the head area of HTML page that have been generated by Add-Meta-Tags for Google+. The hooked function should accept and return 1 argument: An array of links.

amt_schemaorg_metadata_footer

Applied to the Schema.org metatags that have been generated by Add-Meta-Tags for the footer area. The hooked function should accept and return 1 argument: An array of meta tags.

amt_schemaorg_metadata_content

Applied to the Schema.org Microdata that has been generated by Add-Meta-Tags and is embedded around the content. The hooked function should accept and return 1 argument: An array of microdata. Note that articleBody is added to the array after filtering.

Generic archive descriptions

amt_generic_description_category_archive

Applied to the generic description that is used in category archives, in case a custom description has not been set for the category. The hooked function should accept and return 1 argument
A string that contains exactly one %s placeholder, which will be replaced by the category name. Default string: Content filed under the %s category.

amt_generic_description_tag_archive

Applied to the generic description that is used in tag archives, in case a custom description has not been set for the tag. The hooked function should accept and return 1 argument
A string that contains exactly one %s placeholder, which will be replaced by the tag name. Default string: Content tagged with %s.

amt_generic_description_TAXONOMYSLUG_archive

Applied to the generic description that is used in the archive of the term which belongs to the taxonomy with slug TAXONOMYSLUG, in case a custom description has not been set for the term. The hooked function should accept and return 1 argument
A string that contains exactly one %s placeholder, which will be replaced by the taxonomy term name. Default string: Content filed under the %s taxonomy.

amt_generic_description_author_archive

Applied to the generic description that is used in author archives, in case a custom description has not been set for the author. The hooked function should accept and return 1 argument
A string that contains exactly one %s placeholder, which will be replaced by the author's display name. Default string: Content published by %s.

amt_generic_description_posttype_POSTTYPESLUG_archive

Applied to the generic description that is used in the archive of a custom post type with slug POSTTYPESLUG, in case a description has not been set for the custom post type at registration time. The hooked function should accept and return 1 argument: a string that contains exactly one %s placeholder, which will be replaced by the custom post type name. Default string: %s archive.

Image sizes used in metadata

amt_image_size_index

Applied to the image size that is used when generating image related meta tags for the front/archive pages. By default, the size medium is used. The hooked function should accept and return 1 argument
A string containing either one of the default image sizes (thumbnail, medium, large, full) defined by WordPress or the name of any other user-defined image size.

amt_image_size_content

Applied to the image size that is used when generating image related meta tags for content pages. By default, the size medium is used. The hooked function should accept and return 1 argument
A string containing either one of the default image sizes (thumbnail, medium, large, full) defined by WordPress or the name of any other user-defined image size.

amt_image_size_attachment

Applied to the image size that is used when generating image related meta tags for attachment pages. By default, the size large is used. The hooked function should accept and return 1 argument
A string containing either one of the default image sizes (thumbnail, medium, large, full) defined by WordPress or the name of any other user-defined image size.

Metadata exclusion

amt_exclude_basic_metadata

This is a filter based switch that can be used to turn off the generation of basic metadata by returning true.

amt_exclude_dublin_core_metadata

This is a filter based switch that can be used to turn off the generation of Dublin Core metadata by returning true.

amt_exclude_opengraph_metadata

This is a filter based switch that can be used to turn off the generation of Opengraph metadata by returning true.

amt_exclude_schemaorg_metadata

This is a filter based switch that can be used to turn off the generation of Schema.org (both Microdata or JSON+LD) metadata by returning true.

amt_exclude_twitter_cards_metadata

This is a filter based switch that can be used to turn off the generation of Twitter Cards metadata by returning true.

Metadata caching

amt_enable_metadata_cache

This is a filter based switch that can be used to force turn off (return false) metadata caching and also hide the metadata caching settings. Default: true.

amt_enable_metadata_cache_in_content_filter

This is a filter based switch that can be used to force turn off (return false) metadata caching in the filtering function that is attached to the the_content hook. This only affects caching Schema.org microdata. Default: true.

amt_purge_cached_metadata_on_comment_actions

This is a filter based switch that can be used to turn on the automatic purging of the cached metadata of a specific post based on comment actions. This is only useful if you have manually enhanced the generated metadata by adding metadata for comments and need to purge it when comments are published or removed. Default: false.

Metadata Review Mode

Using these filter hooks you can customize the Metadata Review Mode.

amt_metadata_review_text_before

Applied to the introduction text of the Metadata Review mode. The hooked function should accept 4 arguments: 1) the introduction text (string), 2) the metadata block at head section (array), 3) the metadata block at the body area (array), and 4) the metadata block in the content (array). It should return 1 argument: a string

amt_metadata_review_text_after

Applied to the closing text of the Metadata Review mode. The hooked function should accept 4 arguments: 1) the closing text (empty string by default), 2) the metadata block at head section (array), 3) the metadata block at the body area (array), and 4) the metadata block in the content (array). It should return 1 argument: a string

amt_metadata_review_head

Applied to the section of the metadata review area that expects text about the metadata that has been added to the head section of the page. The hooked function should accept 2 arguments: 1) the introduction text of the section (string), 2) the metadata block at head section (array). It should return 1 argument: a string

amt_metadata_review_footer

Applied to the section of the review that expects text about the metadata that has been added to the body of the page. The hooked function should accept 2 arguments: 1) the introduction text of the section (string), 2) the metadata block at the footer area (array). It should return 1 argument: a string

amt_metadata_review_content_filter

Applied to the section of the review that expects text about the metadata that has been added to the body of the page as a result of the Schema.org Microdata content filter. The hooked function should accept 2 arguments: 1) the introduction text of the section (string), 2) the metadata block inside the content (array). It should return 1 argument: a string

amt_metadata_review_mode_enable_alternative

This is a filter based switch that can be used to switch between the new metadata review mode (admin toolbar panel) and the old one (box within the content. By default, (false) the new mode is used. By returning true, the old mode is activated.

amt_metadata_review_mode_enable_highlighter

This is a filter based switch that can be used to turn off the highlighter in metadata review mode. By default, (true) the metadata is highlighted.

Metadata and Content Overview

amt_metadata_analysis_keyword_matching_pattern

Applied to the regular expression that is used to locate the keywords in any piece of text. The hooked function should accept 1 argument: a string (full preg_match_all pattern).

Full Meta Tag Boxes

amt_full_metatags_site

Applied to the site wide full meta tags of the plugin settings page. The hooked function should accept and return 1 argument: a string.

amt_full_metatags_post

Applied to the post specific full meta tags. The hooked function should accept and return 1 argument: a string.

amt_full_metatags_processed

Applied to the site wide plus the post specific (on content pages only) full meta tags. The hooked function should accept and return 1 argument: an array.

amt_full_metatags_processor_enable

This is a filter based switch which can be used to turn full meta tag processing, like the compacting of multiple robots meta tags, the autodetection of custom canonical link, and the substitution of the special notation with values from custom fields. Return true/false.

Other

amt_get_the_excerpt

Applied to the description that Add-Meta-Tags generates from the first paragraph of the content if no other description has been defined by the user. The hooked function should accept and return 1 argument
A string.

amt_paged_append_data

Applied to the data that should be appended when paginated content is encountered and a page number greater than 1 is displayed. The hooked function should accept and return 1 argument
A string.

amt_supported_post_types

Applied to the list of post types Add-Meta-Tags should add metadata to. By default, this list includes posts, pages, attachments and all available public post types. The hooked function should accept and return 1 argument
An array of post types.

amt_metadata_metabox_permissions

Applied to the default permissions that control whether the Metadata metabox as a whole or each individual box is displayed in the post, page and custom post type's editing screen depending on the user's capabilities. The hooked function should accept and return 1 argument
An array. For the details about the available settings, please see Example 10 below.

amt_embedded_media

Applied to the array in which Add-Meta-Tags stores information about the embedded media. The hooked function should accept and return 1 argument
An array of post types. The hooked function can also accept the post ID as a second optional argument.

amt_embedded_media_external

May be used to inject URLs of supported embeddable media to the content that is used by the alforithm that detects embeddable media in the post content. By default this array is empty. The hooked function should accept and return 2 argumenta: 1) an array of URLs 2) the post object.

amt_valid_full_metatag_html

Applied to all list of valid HTML elements and attributes that can be used in the 'Full Meta Tags' boxes in the general settings and in the metabox. The hooked function should accept and return 1 argument
An array of valid elements and their attributes. The provided array has the same format as the $allowed_html array of the <a href="http://codex.wordpress.org/Function_Reference/wp_kses">wp_kses function</a>.

amt_image_video_preview

Applied to the image size that is used when generating meta tags containing a preview image (for instance the twitter:image meta tag of Twitter Player cards) for a video or audio attachment. By default, the size full is used, as the user is expected to properly resized the image which is used as the featured image of the video attachment. The hooked function should accept and return 1 argument
A string containing either one of the default image sizes (thumbnail, medium, large, full) defined by WordPress or the name of any other user-defined image size.

amt_extended_image_tags

By default, extended image meta tags containing information like the width/height/type are generated for each image. The hooked function should accept and return 1 argument
A boolean object. If the hooked function returns false those additional meta tags (width/height/type) are not generated.

amt_robots_options

Applied to the options of the robots meta tag. The hooked function should accept and return 1 argument: an array.

amt_custom_title

Applied to the custom title, if a custom title has been set in the post editing panel, otherwise it is not processed. The hooked function should accept and return 1 argument
A string.

amt_embed_enforce_ssl

By default, SSL access to the page that contains the embedded local player is enforced. The hooked function should accept and return 1 argument
A boolean object.

amt_embed_enabled

By default, the page that contains the embedded local player is enabled. The hooked function should accept and return 1 argument
A boolean object.

amt_embed_includes_url

Applied to the URI of the wp-includes directory. The hooked function should accept and return 1 argument
A string.

Title Templates

amt_titles_title_element_templates

Applied to the title templates that are used for the content of the title HTML element. The hooked function should accept 2 arguments: the array of templates and the post object. It should return 1 argument: an array of title templates.

amt_titles_metadata_title_templates

Applied to the title templates that are used for the titles within the metadata. The hooked function should accept 2 arguments: the array of templates and the post object. It should return 1 argument: an array of title templates.

Multilanguage Content

amt_settings_site_description

Applied to the site description of the general settings of the plugin. The hooked function should accept and return 1 argument: A string.

amt_settings_site_keywords

Applied to the site keywords of the general settings of the plugin. The hooked function should accept and return 1 argument: A string.

amt_settings_global_keywords

Applied to the global keywords of the general settings of the plugin. The hooked function should accept and return 1 argument: A string.

amt_language_site

Applied to the language/locale of the web site. By default, get_bloginfo('language') is returned. The hooked function should accept and return 1 argument: a string.

amt_language_content

Applied to the language/locale of the current content. By default, get_bloginfo('language') is returned. The hooked function should accept and return 1 argument: a string. The hooked function can also accept the post object as a second optional argument.

External data filter hooks

amt_external_description_fields

Applied to the list of external custom fields from which Add-Meta-Tags can read data for the description metatag. The hooked function should accept and return 1 argument: An array of field names. The hooked function can also accept the post ID as a second optional argument. Keep in mind that Add-Meta-Tags always saves description data to its default field, regardless of the field the data was read from.

amt_external_keywords_fields

Applied to the list of external custom fields from which Add-Meta-Tags can read data for the keywords metatag. The hooked function should accept and return 1 argument: An array of field names. The hooked function can also accept the post ID as a second optional argument. Keep in mind that Add-Meta-Tags always saves keywords data to its default field, regardless of the field the data was read from.

amt_external_title_fields

Applied to the list of external custom fields from which Add-Meta-Tags can read data for the title metatag. The hooked function should accept and return 1 argument: An array of field names. The hooked function can also accept the post ID as a second optional argument. Keep in mind that Add-Meta-Tags always saves title data to its default field, regardless of the field the data was read from.

amt_external_news_keywords_fields

Applied to the list of external custom fields from which Add-Meta-Tags can read data for the news_keywords metatag. The hooked function should accept and return 1 argument: An array of field names. The hooked function can also accept the post ID as a second optional argument. Keep in mind that Add-Meta-Tags always saves news_keywords data to its default field, regardless of the field the data was read from.

amt_external_full_metatags_fields

Applied to the list of external custom fields from which Add-Meta-Tags can read full meta tag HTML code. The hooked function should accept and return 1 argument: An array of field names. The hooked function can also accept the post ID as a second optional argument. Keep in mind that Add-Meta-Tags always saves full meta tag data to its default field, regardless of the field the data was read from.

amt_external_image_url_fields

Applied to the list of external custom fields from which Add-Meta-Tags can read the image URL. The hooked function should accept and return 1 argument: A URL as a string. The hooked function can also accept the post ID as a second optional argument. Keep in mind that Add-Meta-Tags always saves the image URL to its default field, regardless of the field the data was read from.

amt_external_express_review_fields

Applied to the list of external custom fields from which Add-Meta-Tags can read review related information. The hooked function should accept and return 1 argument: A string. The hooked function can also accept the post ID as a second optional argument. Keep in mind that Add-Meta-Tags always saves review information to its default field, regardless of the field the data was read from.

amt_external_referenced_list_fields

Applied to the list of external custom fields from which Add-Meta-Tags can read lists of URLs of referenced items. The hooked function should accept and return 1 argument: An array of field names. The hooked function can also accept the post ID as a second optional argument. Keep in mind that Add-Meta-Tags always saves URL lists of referenced items to its default field, regardless of the field the data was read from.

Action Hooks

Metadata Review Mode

amt_metadata_review_mode_pretext

Use to print before the metadata review mode text.

amt_metadata_review_mode_posttext

Use to print after the metadata review mode text.