aioseo_twitter_tags

Purpose

This filter can be used to filter the Twitter meta tags All in One SEO outputs.

Arguments (1)

  1. $twitterTags (array) – The Twitter meta tags.
$attributes = [
	'twitter:card'        => '',
	'twitter:site'        => '',
	'twitter:domain'      => '',
	'twitter:title'       => '',
	'twitter:description' => '',
	'twitter:image'       => ''
];

The list of meta tags above is not exhaustive.

Example code snippet

The code snippet below is just an example of how this filter can be used. In the example below, the Twitter title for a specific post is changed.

add_filter( 'aioseo_twitter_tags', 'aioseo_filter_twitter_title' );

function aioseo_filter_twitter_title( $twitterMeta ) {
   if ( is_singular() && '14' === get_the_ID() ) {
      $twitterMeta['twitter:title'] = "A different title";
   }
   return $twitterMeta;
}