I’m looking for a way to show Yoast Seo Title in the frontend as shortcode.
For example: for showing page title as shortcode I’ve added
<?php function page_title_sc( ){ return get_the_title(); } add_shortcode( ‘page_title’, ‘page_title_sc’ );
to the functions.php then added [page_title]
to the frontend, and it’s ok. But I want the SEO page title (yoast seo). Any ideas?
2
Answers
Thank you for responding.
It returns page title, not seo title. :( I'm interested in showing seo title on every page (not only on posts).
This should grab the Yoast SEO title for a post. Put this in your shortcode callback and return
$title
: