Add Meta Tags Wordpress Plugin - Rating, Reviews, Demo & Download
Plugin Description
Add-Meta-Tags (AMT) adds metadata to your content, including the basic description and keywords meta tags, Opengraph, Schema.org, Twitter Cards and Dublin Core metadata. It is actively maintained since 2006 (historical Add-Meta-Tags home).
Goals
The goals of the Add-Meta-Tags plugin are:
- provide efficient, out-of-the-box search engine optimization (SEO) on a web site powered by WordPress.
- be customizable, yet simple and easy to use and configure with minimal or no support.
- be as lightweight as possible.
- support advanced customization through the WordPress filter/action system (for developers and advanced users).
Free License and Donations
Add-Meta-Tags is released under the terms of the Apache License version 2 and, therefore, is Free software.
However, a significant amount of time and energy has been put into developing this plugin, so, its production has not been free from cost. If you find this plugin useful and if it has helped your blog get indexed better and rank higher, you can show your appreciation by making a small donation.
Donations in the following crypto currencies are also accepted and welcome. Send coins to the following addresses:
- BitCoin (BTC):
1KkgpmaBKqQVk643VRhFRkL19Bbci4Mwn9
- LiteCoin (LTC):
LS8UF39LfLahzGo49y736ooRYBVT1zZ2Fa
Thank you in advance for donating!
What it does
Add-Meta-Tags (AMT) adds metadata to your web site. This metadata contains information about the content, the author, the media files, which have been attached to your content, and even about some of the embedded media (see the details about this feature in the relevant section below).
Metadata refers to information that describes the content in a machine-friendly way. Search engines and other online services use this metadata to better understand your content. Keep in mind that metadata itself does not automatically make your blog rank better. For this to happen the content is still required to meet various quality standards. However, the presence of accurate and adequate metadata gives search engines and other services the chance to make less guesses about your content, index and categorize it better and, eventually, deliver it to an audience that finds it useful. Good metadata facilitates this process and thus plays a significant role in achieving better rankings. This is what the Add-Meta-Tags plugin does.
The following list outlines how and where metadata is added to a WordPress blog.
Basic meta tags
The description and keywords meta tags are added:
Front Page
- Automatic addition of the blog’s tagline in the description metatag.
- Automatic addition of the blog’s categories in the keywords metatag.
- Customization is possible through the plugin’s administration panel.
- If a static page is used as the front page, customization is possible at the page’s editing panel (Metadata box).
Posts & Pages
- Automatic addition of an auto-generated excerpt of the post’s or page’s content in the description metatag. In case a post has a user-defined excerpt, then this is what is used.
- Automatic addition of the post’s categories and tags in the keywords meta tag. Pages do not support categories and tags, so there is no automatic addition of the keywords metatag.
- Customization is possible by adding a custom description and keywords in the post’s or page’s editing panel (Metadata box).
Attachment Pages
- A description metatag is automatically generated from the caption or, if a caption has not been set, from the description of the attachment.
Custom Post Types
- A description is automatically generated from the first paragraph of the content. Keywords are not generated automatically.
- Customization of the description and keywords meta tags is possible at the post type’s editing panel (Metadata box).
Category-based Archives
- The description of the category, if set, is used in the description meta tag. If a description does not exist, then a generic one is used.
- The name of the category is always used in the keywords metatag.
Tag-based Archives
- The description of the tag, if set, is used in the description meta tag. If a description does not exist, then a generic one is used.
- The name of the tag is always used in the keywords metatag.
Custom Taxonomy based Archives
- The description of the taxonomy term, if set, is used in the description meta tag. If a description does not exist, then a generic one is used.
- The name of the taxonomy term is always used in the keywords metatag.
Author-based Archives
- The bio of the WordPress user, if set, is used in the description meta tag on the first page of the author archive. All other author archive pages use a generic description.
- The categories of the posts that are currently being displayed in the page are used in the keywords meta tag.
Extended Meta Tag Support
The following advanced features are also available:
Global keywords
- It is possible to set some keywords that are prepended/appended to the keywords of all your content.
Site-wide META Tags
- It is possible to force any metatags site-wide.
Custom title tag
It is possible to customize the title element on posts, pages and public custom post types.
‘news_keywords’ meta tag
It is possible to set a news_keywords meta tag for posts, pages and any public custom post type.
For more info about the news_keywords metatag, please read this Google help page.
Per post full meta tags
It is possible to assign custom full meta tags to single posts (posts, pages, custom post types).
Per post referenced items (EXPERIMENTAL)
It is possible to enter URLs of referenced items in each single post (posts, pages, custom post types), which results in the generation of the relevant og:referenced
(OpenGraph) and referencedItem
(Schema.org) meta tags.
Copyright Metatag
It is possible to add a head link to a user-defined copyright page.
Default Image
A path to an image, for instance the we site’s logo, can be set in order to be used in autogenerated metadata if a featured image has not been set for the content.
Opengraph metadata
Opengraph meta tags can be automatically added to the front page, posts, pages, attachment pages and author archive.
Schema.org Microdata
Schema.org Microdata can be automatically added to the front page, posts, pages, image attachment pages and author archive.
The plugin automatically marks up posts, pages and custom post types as Article
objects and also images, videos and audio as Image
, Video
and Audio
MediaObjects respectively. It also considers the web site as an Organization
object and the author as a Person
object.
Also, make sure you read Gingerling’s guide about how to enable Google Authorship using the Add-Meta-Tags plugin on your WordPress blog (thanks Anna!).
Twitter Cards
Twitter Cards can be automatically generated for content and attachment pages. The type of card that is generated depends either on the post format or the mime type of the attachment. More specifically:
- A
summary
card is generated for posts with one of thestandard
,aside
,link
,quote
,status
andchat
formats. - A
summary_large_image
card is generated for posts with theimage
format. An image is expected to be attached or embedded to the post. - A
gallery
card is generated for posts with thegallery
format. At least one image is expected to be attached or embedded to the post. - A
photo
card is generated for image attachment pages. - A
player
card is generated for posts with theaudio
orvideo
format and for audio or video attachment pages. Regarding posts, an audio or video is expected to be attached or embedded to the post.
The generation of a player
card that renders a player for locally hosted audio and video files has very specific requirements, as outlined in the Player Card specifications. This is why there is a separate option in the plugin configuration panel that enables this feature. In short, enable this feature only if access over the secure HTTPS protocol (SSL) has been configured for your web site, otherwise the Player cards will not be rendered by Twitter.
Moreover, in order to generate the twitter:image
meta tag of the Player Card of locally hosted audio and video files, it is required to set a featured image on the attachment or on the parent post. By default, Add-Meta-Tags uses the full
size of the image for the generation of the twitter:image
meta tag. Advanced users can use the amt_image_video_preview
filter to customize this image size (see examples below about how to use the available filters).
Dublin Core metadata
Dublin Core metatags can be automatically added to posts and pages and attachment pages.
Other Features
Extra SEO features
- Add the
NOODP,NOYDIR
option to the robots meta tag. - Add the
NOINDEX,FOLLOW
options to the robots meta tag on category, tag, author or time based archives and search results.
Metadata Review Mode
When enabled, WordPress users with administrator privileges see a box (right above the post’s content) containing the metadata exactly as it is added in the HTML head and body for easier examination. The box is displayed for posts, pages, attachments and custom post types.
Metadata for embedded media
Add-Meta-Tags generates detailed metadata for the media that have been attached to the content. This happens for all the media you manage in the WordPress media library.
Apart from attaching local media to the content, WordPress lets authors also embed external media by simply adding a link to those media inside the content or by using the shortcode. Several external services are supported.
Add-Meta-Tags can detect some of those media and generate metadata for them. Currently, only links to Youtube, Vimeo and Vine videos, Soundcloud tracks and Flickr images are supported. So, even if you host your media externally on those services, this plugin can still generate metadata for them. This metadata is by no means as detailed as the metadata that is generated for local media, but it gives search engines a good idea about what external media are associated with your content.
This feature relies entirely on the data WordPress has already cached for the embedded media. The plugin will never send any requests to external services attempting to get more detailed information about the embedded media as this would involve unacceptable overhead.
Here is what is supported:
- Links to Youtube videos of the form:
http://www.youtube.com/watch?v=VIDEO_ID
- Links to Vimeo videos of the form:
http://vimeo.com/VIDEO_ID
- Links to Vine videos of the form:
https://vine.co/v/VIDEO_ID
- Links to Soundcloud tracks of the form:
https://soundcloud.com/USER_ID/TRACK_ID
- Links to Flickr images of the form:
http://www.flickr.com/photos/USER_ID/IMAGE_ID/
This feature should be considered experimental. This information might be changed in future versions of the plugin.
Translations
There is an ongoing effort to translate Add-Meta-Tags to as many languages as possible. The easiest way to contribute translations is to register to the translations project at the Transifex service.
Once registered, join the team of the language translation you wish to contribute to. If a team does not exist for your language, be the first to create a translation team by requesting the language and start translating.
Code Contributions
If you are interested in contributing code to this project, please make sure you read the special section for this purpose, which contains all the details.
Support and Feedback
Please post your questions and provide general feedback and requests at the Add-Meta-Tags Community Support Forum.
To avoid duplicate effort, please do some research on the forum before asking a question, just in case the same or similar question has already been answered.
Also, make sure you read the FAQ.
Advanced Customization
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:
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 thatarticleBody
is added to the array after filtering.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 theMetadata
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 seeExample 10
below.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_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.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 wp_kses function.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 sizemedium
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 sizemedium
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 sizelarge
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_video_preview
– applied to the image size that is used when generating meta tags containing a preview image (for instance thetwitter:image
meta tag of Twitter Player cards) for a video or audio attachment. By default, the sizefull
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 returnsfalse
those additional meta tags (width/height/type) are not generated.amt_robots_data
– applied to the content of therobots
meta tag. The hooked function should accept and return 1 argument: a string.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 slugTAXONOMYSLUG
, 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_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 thewp-includes
directory. 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.
Example 1: you want to replace the autogenerated og:site_name
Opengraph metatag with a custom one.
This can easily be done by hooking a custom function to the amt_opengraph_metadata_head
filter:
function customize_og_sitename_metatag( $metatags ) {
// ... replace 'og:site_name' here
return $metatags;
}
add_filter( 'amt_opengraph_metadata_head', 'customize_og_sitename_metatag', 10, 1 );
This code can be placed inside your theme’s functions.php
file.
Example 2: you want to limit the generation of metadata by Add-Meta-Tags to specific post types.
This can easily be done by hooking a custom function to the amt_supported_post_types
filter:
function limit_metadata_to_post_types( $post_types ) {
// ... process and return the $post_types array
// ... or just return a custom array of post types
return array( 'post', 'book', 'project');
}
add_filter( 'amt_supported_post_types', 'limit_metadata_to_post_types', 10, 1 );
This code can be placed inside your theme’s functions.php
file.
Example 3: you use plugin X that saves the descriptions, keywords, etc in its custom fields. You want to migrate to Add-Meta-Tags and need to read the fields of your old plugin.
This can easily be done by hooking custom functions to the amt_external_description_fields
and amt_external_keywords_fields
filters:
function read_old_plugin_description_field( $extfields ) {
// Although $extfields is currently empty, it's a good practice to
// append your old plugins description field to the $extfields array.
array_unshift( $extfields, 'my_old_plugin_description_field' );
return $extfields;
}
add_filter( 'amt_external_description_fields', 'read_old_plugin_description_field', 10, 1 );
function read_old_plugin_keywords_field( $extfields, $post_id ) {
// This function also demonstrates how to get and possibly use the post's ID
// Append your old plugins keywords field to the $extfields array
if ( in_array( $post_id, array( 1, 2, 5, 8 ) ) ) {
array_unshift( $extfields, 'my_old_plugin_keywords_field' );
}
return $extfields;
}
add_filter( 'amt_external_keywords_fields', 'read_old_plugin_keywords_field', 10, 2 );
This code can be placed inside your theme’s functions.php
file.
Keep in mind that:
- AMT internal fields have priority over the external fields. If both the internal field and an external field contain data, then the data of the internal field is used.
- AMT uses external fields to only read data. It never writes to external fields. Whenever the content is saved, every piece of information, which may have been read from an external field, is stored to the relevant AMT internal field. Consequently, when the content is saved, information from external fields is migrated to the AMT internal fields, and external fields have no effect on this specific content any more.
Example 4: Add the title
element to the valid html elements for use in the full meta tags box.
This can easily be done by hooking custom functions to the amt_valid_full_metatag_html
filter:
function extend_full_metatag_valid_elements( $valid_elements ) {
// Construct the title element array (key: element name, value: array of valid attributes)
$title_element = array( 'title' => array() );
// Append the 'title' element to the valid elements
$valid_elements = array_merge( $valid_elements, $title_element );
return $valid_elements;
}
add_filter( 'amt_valid_full_metatag_html', 'extend_full_metatag_valid_elements', 10, 1 );
Example 5: Customize the default image sizes used when generating image related meta tags for front/archive, content and attachment pages.
This can easily be done by hooking custom functions to the amt_image_size_index
, amt_image_size_content
, amt_image_size_attachment
filters:
Here we customize the generation of all image related meta tag, so that the full
image size is used. Since the same image size is used for all types of pages, a single function is hooked to all filters.
function amt_use_full_image_size_in_all_meta_tags( $size ) {
return 'full';
}
add_filter( 'amt_image_size_index', 'amt_use_full_image_size_in_all_meta_tags', 10, 1 );
add_filter( 'amt_image_size_content', 'amt_use_full_image_size_in_all_meta_tags', 10, 1 );
add_filter( 'amt_image_size_attachment', 'amt_use_full_image_size_in_all_meta_tags', 10, 1 );
This code can be placed inside your theme’s functions.php
file.
Example 6: Add the fb:admins
and the fb:app_id
OpenGraph meta tags.
This can easily be done by hooking a custom function to the amt_opengraph_metadata_head
filter:
function amt_extend_og_metatags( $metatags ) {
$metatags[] = '<meta property="fb:admins" content="ENTER_USER_ID_HERE" />';
$metatags[] = '<meta property="fb:app_id" content="ENTER_APPID_HERE" />';
return $metatags;
}
add_filter( 'amt_opengraph_metadata_head', 'amt_extend_og_metatags', 10, 1 );
This code can be placed inside your theme’s functions.php
file.
Example 7: Generate compact image meta tags (meta tags for width/height/type are suppressed).
This can easily be done by hooking a custom function to the amt_extended_image_tags
filter:
function amt_generate_extended_image_tags( $default ) {
return false;
}
add_filter( 'amt_extended_image_tags', 'amt_generate_extended_image_tags', 10, 1 );
This code can be placed inside your theme’s functions.php
file.
Example 8: Customize the generic descriptions in the category, tag, custom taxonomy and author archives.
This can easily be done by hooking custom functions to the amt_generic_description_category_archive
, amt_generic_description_tag_archive
, amt_generic_description_taxonomy_archive
and amt_generic_description_author_archive
filters:
function amt_custom_category_archive_description( $default ) {
return 'Articles in the %s section.';
}
add_filter( 'amt_generic_description_category_archive', 'amt_custom_category_archive_description', 10, 1 );
function amt_custom_tag_archive_description( $default ) {
return 'Products tagged with %s.';
}
add_filter( 'amt_generic_description_tag_archive', 'amt_custom_tag_archive_description', 10, 1 );
function amt_custom_mytaxonomyslug_archive_description( $default ) {
return 'Members of the %s group.';
}
add_filter( 'amt_generic_description_mytaxonomyslug_archive', 'amt_custom_mytaxonomyslug_archive_description', 10, 1 );
function amt_custom_author_archive_description( $default ) {
return 'Projects started by %s.';
}
add_filter( 'amt_generic_description_author_archive', 'amt_custom_author_archive_description', 10, 1 );
This code can be placed inside your theme’s functions.php
file.
Example 9: Programmatically customize the custom title as it has been entered in the post editing panel.
This can easily be done by hooking custom functions to the amt_custom_title
filter. Please not that this filter is processed only if a custom title has been added to the post in the Metadata
box.
function amt_custom_title_modified( $title ) {
return $title . ' | ';
}
add_filter( 'amt_custom_title', 'amt_custom_title_modified', 10, 1 );
This code can be placed inside your theme’s functions.php
file.
Example 10: You want to set stricter permissions for the Metadata metabox.
This can easily be done by hooking a custom function to the amt_metadata_metabox_permissions
filter.
function amt_custom_metadata_metabox_permissions( $default_permissions ) {
//
// This array contains the default Metadata metabox permission settings.
// Regardless of these settings the 'edit_posts' capability is _always_
// checked when reading/writing metabox data, so the 'edit_posts' capability
// should be considered as the least restrictive capability that can be used.
// The available Capabilities vs Roles table can be found here:
// http://codex.wordpress.org/Roles_and_Capabilities
// To disable a box, simply add a very restrictive capability like 'create_users'.
//
$permissions = array(
// Minimum capability for the metabox to appear in the editing
// screen of the supported post types.
'global_metabox_capability' => 'edit_posts',
// The following permissions have an effect only if they are stricter
// than the permission of the 'global_metabox_capability' setting.
// Edit these, only if you want to further restrict access to
// specific boxes, for example the 'full metatags' box.
'description_box_capability' => 'edit_posts',
'keywords_box_capability' => 'edit_posts',
'title_box_capability' => 'edit_posts',
'news_keywords_box_capability' => 'edit_posts',
'full_metatags_box_capability' => 'edit_posts',
'referenced_list_box_capability' => 'edit_posts'
);
return $permissions;
}
add_filter( 'amt_metadata_metabox_permissions', 'amt_custom_metadata_metabox_permissions', 10, 1 );
This code can be placed inside your theme’s functions.php
file.
Example 11: Customize the size of the video player in Player Twitter Cards.
This can easily be done by hooking a custom function to the amt_twitter_cards_video_player_size
filter.
function amt_custom_twitter_cards_video_player_size( $default ) {
return array(320, 240);
}
add_filter( 'amt_twitter_cards_video_player_size', 'amt_custom_twitter_cards_video_player_size', 10, 1 );
This code can be placed inside your theme’s functions.php
file.
Custom Fields
Add-Meta-Tags uses the following internal custom fields to store data related to the content:
_amt_description
– the content’s custom description (thedescription
field is also read as a fallback for backwards compatibility)._amt_keywords
– the content’s custom keywords (thekeywords
field is also read as a fallback for backwards compatibility)._amt_title
– the content’s custom title._amt_news_keywords
– the content’s custom news keywords._amt_full_metatags
– the content’s full meta tag code._amt_referenced_list
– list of URLs of items referenced in the post.
The contact methods added by Add-Meta-Tags are:
amt_facebook_author_profile_url
as Facebook author profile URL (AMT)amt_facebook_publisher_profile_url
as Facebook publisher profile URL (AMT)amt_googleplus_author_profile_url
as Google+ author profile URL (AMT)amt_googleplus_publisher_profile_url
as Google+ publisher page URL (AMT)amt_twitter_author_username
as Twitter author username (AMT)amt_twitter_publisher_username
as Twitter publisher username (AMT)
Template Tags
The following template tags are available for use in your theme:
amt_content_description()
: prints the content’s description as generated by Add-Meta-Tags.amt_content_keywords()
: prints a comma-delimited list of the content’s keywords as generated by Add-Meta-Tags.amt_metadata_head()
: prints the full metadata for the head area as generated by Add-Meta-Tags.amt_metadata_footer()
: prints the full metadata for the head area as generated by Add-Meta-Tags.
Theme Requirements
Add-Meta-Tags uses the wp_head
and wp_footer
action hooks to embed metadata to the HTML HEAD and the HTML BODY. Therefore, it is essential that your theme includes these two action hooks in its templates.
More
Check out other open source software by George Notaras.
Screenshots
-
Add-Meta-Tags administration interface (
Options -> Metadata
). -
Enable Metadata meta box in the screen options of the post editing panel.
-
Metadata box in the post editing panel.
-
Contact info entries added by Add-Meta-Tags (AMT) in the user profile page.