Unable to get Meta Description

[ad_1]

I am trying to get the Meta Description created by this plugin. Working for Yoast and Rank Math, but nothing comes in the Frontend for All in one SEO plugin. I even entered a description on Meta Description box of the plugin in the post.

<?php$post_id = get_the_ID();// Check for Yoast SEO description

$post_description = get_post_meta($post_id, '_yoast_wpseo_metadesc', true);// If Yoast SEO description is not available, check for Rank Math description

if (empty($post_description)) { $post_description = get_post_meta($post_id, 'rank_math_description', true);}// If Rank Math description is not available, check for All in One SEO description

if (empty($post_description)) { $post_description = get_post_meta($post_id, '_aioseop_description', true);}// Display the post description if available

if (!empty($post_description)) { echo '<p class="pDesc">' . esc_html($post_description) . '</p>';}?>

I am developing a WordPress theme, so this is required for users who want to display the meta description for human visitors. Please help.

  • This topic was modified 8 hours, 30 minutes ago by gentheme.

The page I need help with: [log in to see the link]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer