You can just check if $meta
and $meta_desc
exist. If not, don’t echo anything.
$popular_topics = get_field('popular_topics');
if ( $popular_topics ) :
foreach ( $popular_topics as $topic ) :
$id = $topic->term_id;
$meta = get_option('wpseo_taxonomy_meta');
if ( $id && ( $meta && !empty($meta) ) ) :
$meta_desc = $meta['category'][$id]['wpseo_desc'];
if ( $meta_desc ) : ?>
<p class="my-paragraph">
<?php echo esc_html( $meta_desc ); ?>
</p>
<?php
endif;
endif;
endforeach;
endif;
Related Posts:
- Custom Yoast Breadcrumbs URL
- Set Primary category using the Yoast SEO plugin
- Can I change the contents of a description meta tag generated by Yoast?
- Getting error when trying to implement site-wide breadcrumbs in Twentytwentyone Theme [closed]
- Auto-Select Parent Category as Primary
- Can’t print Yoast meta description into page template (syntax error, unexpected ‘.’) [closed]
- WordPress yoast seo plugin – parse snippet var in meta description
- Genesis / custom template page / setting the page title and meta desc
- Workaround for og:image unsupported webp image type, Yoast SEO?
- WordPress: Export/Import Yoast meta title & description to custom taxonomy
- Custom function that re-writes page title breaks when the Yoast plugin is activated
- Using $this with an anonymous function in filters
- How to display custom seo title before the loop?
- seo meta description issue in google search
- the_date() not working
- How to return number of found rows from SELECT query
- WP-API v2 Custom Endpoint Response Formatting
- Get author full name
- Is it possible to get a theme customizer setting from wp.customize using jquery?
- Extract the first oembed url inserted on the content of a post
- WP API V2 returning Invalid User ID
- Why does $_SESSION only work when I am logged in?
- How to make an meta_query optional?
- Limit the_excerpt with max of x characters
- How to use copy() function and paste file in /wp-content/themes directory
- How can update custom meta for all posts
- Sanitize get_query_var() url parameters
- PHP/MySQL issues when running WP on EC2 cloud [closed]
- How to safely remove the footer (twentytwenty)
- It is a good idea to store values from the global $post if they are used multiple times?
- How do I fetch all comments per post via WP REST API?
- When using the_author hook, how can I determine the PHP file that generates each call to `the_author()`?
- esc_url returns incorrect URL
- Using More Tag in Combination with the_excerpt
- combine Code 1 with Code 2
- Custom Form Processing Issue
- Custom theme: Alternatives to long list of ‘include’ in functions.php
- Reordering Buddy Press profile navigation [closed]
- How can I get the total number of installed importers?
- MetaBox body is not showing (the callback function)
- wpdb php get_var query to get ID for URL image doesn’t work for ID over 999
- Change title only in dynamic page
- How to make products with no cost in WooCommerce
- Pass php dynamic variable to shortcode
- Insert term and child term from frontend
- two columns of posts on homepage, one of them “favorites”
- Help with .htaccess and Login with Subfolders
- Catchable fatal error on 3.6 update
- AJAX – Returning Two JSON Objects with One PHP Function
- Can’t Query Custom Table Using $wpdb Method
- How can I access string value in an array?
- Defined WordPress Memory Limit to Unlimited
- WordPress gallery shortag
- Design with Elementor and code the rest?
- How to use mysql LIKE with wpdb?
- Get all posts as an array ID => Name
- How to store multiple custom meta box
- cURL error 6 on news area, and also won’t auto update
- Custom upload folder
- How to manually trigger a redirect to another page without changing the url address?
- How to use title attributes in sidebar widget?
- Displaying Event within two given time frames
- How to get my [shortcode] rendered on the home page, other pages are fine
- Display movies that apear this day next
- Wp favorites posts by specific category? [closed]
- How to add JS script in specific pages in WordPress?
- Fatal error login WordPress [duplicate]
- Pagination contents not changing in Front page WordPress
- How to select post ID for given parent name with nested prepared queries?
- How do I programmatically add ‘reviews_allowed’ to WooCommerce product?
- Why is values of a global variable returning blank when inserted into database
- How to return html as a string from php for WordPress
- Show Gutenberg facebook embed with a custom theme
- Add code to the header of posts by particular author
- Running a PHP SQL script on a wordpress page
- Can I disable auto increment of WordPress Posts Database to utilize previously deleted records?
- Taxonomy Child Term, Counter is staying on 0
- How to apply ‘add two more posts’ to media content?
- How to disable sub menu items from being created?
- Access to “My Site” is missing from the admin bar
- Unable to insert current username into custom table through html form
- add ‘publish metabox’ to Gravity forms edit page/form area
- LinkedIn Share Post Button
- load a wordpress page into another wordpress page using iframe
- How do I modify the Previous and Next Page posts on blog pages to include “previous” and “next” before the links?
- How can i iterate through this shortcode array?
- Explode Content within specific HTML element
- Using get_theme_mod with checkbox to display content
- Add specific content after specific text in every post
- On selecting shortcode generate selected shortcode table inside page editor worrdpress
- Using existing widget code! [closed]
- Pagenav Not appearing on custom Template
- How To Customize Position of »add to cart« of WooCommerce on Product Page [closed]
- Automatically load WordPress page on server every XX hours
- Open WordPress Page from selected option dropdown
- How can I change the URL via add_rewrite_rule()
- Variable ++ in query loop
- Generate and upload screenshot as featured image for user-submitted post
- How can precision be improved for the debug log timestamp?
- How can I change the location where the custom field is displayed in the Quick Edit tab in WordPress