Display Meta description for human visitors
-
My theme don’t have any feature to display post meta description below post title or <h1>.
So I decided to display generated by Yoast meta description. I want to get the description that I have written when publishing article using Yoast plugin.
ChatGPT gave me to automatically get description under a paragraph generated by Yoast plugin.
<p class=”sub-title”> <?php $post_id = get_the_ID(); $post_description = get_post_meta( $post_id, ‘_yoast_wpseo_metadesc’, true ); if ( ! empty( $post_description ) ) { echo $post_description; } ?></p>
it will work? Still _yoast_wpseo_metadesc works to get description? Because I found wpseo_metadesc. Which one will work and comfortable with latest version of the plugin and WP 6.1
- The topic ‘Display Meta description for human visitors’ is closed to new replies.