Leo
(@leohsiang)
Hi there,
SEO plugin is needed for something like this unfortunately.
Maybe try Yoast? Not sure if they have this option in the free version either.
Theme Author
Tom
(@edge22)
Hi there,
You should be able to use a filter like this if you can’t use a plugin:
add_filter( 'document_title_parts', function( $title ) {
if ( is_page( 'your-page-slug' ) ) {
$title['title'] = 'Your custom title here';
}
return $title;
} );
You would just need to replace the your-page-slug with the slug of the page you’re targeting, and of course the Your custom title here part with your title.
A plugin like Yoast makes this kind of thing much easier 🙂
Thanks, Tom! This looks like exactly what I need, but unfortunately it doesn’t seem to work for 4.7.12. When I put the code into functions.php it still displays the old title instead of the new one.
What is it you’re trying to do that isn’t part of All in One SEO Pack?
You can set the SEO title for any post in the AIOSEOP section: https://semperplugins.com/documentation/post-settings/
There’s also a filter hook https://semperplugins.com/documentation/aioseop_title/
Theme Author
Tom
(@edge22)
Thanks, Michael! That looks like a much easier solution 🙂