Notice: There is no legacy documentation available for this item, so you are seeing the current documentation.
Purpose
This filter can be used to filter the SEO title tag.
Arguments (1)
- $title (string) – The page title.
Example code snippet
The code snippet below is just an example of how this filter can be used. In the example below, a specific string is appended to the title of each post.
add_filter( 'aioseo_title', 'aioseo_filter_title' );
function aioseo_filter_title( $title ) {
if ( is_singular() ) {
return $title . 'some additional title content here';
}
return $title;
}
The code snippet below is an example of how this filter can be used to limit the SEO title tag output in the page source code to 60 characters.
add_filter( 'aioseo_title', 'aioseo_truncate_title' );
function aioseo_truncate_title( $title ) {
if ( strlen($title) > 60 ) {
$title = substr($title, 0, 60);;
}
return $title;
}