The issue is that when you don’t have any speakers, you don’t have anything to pass to your include
parameter.
You could solve it by wrapping the code in a conditional so it only runs if there are speakers attached to that post.
$speakers = get_post_meta( $post->ID, 'min_webinar_speaker', false );
if ($speakers != '') { // <- you may need to do a more thorough check than this
... run the code...
}
Related Posts:
- Very Slow Page – How to Optimize # of Queries?
- How can I group posts by months and years?
- Loop increase number
- Using wp_query to modify the loop in index.php for a CPT
- Trying to add a class to post links
- foreach loop inside the loop creating duplicates in output
- Page that lists publications by classifying them by taxonomy
- WordPress loop add heading before first of type
- How to make a shortcode for my WP_Query Loop? [duplicate]
- Strange behavior on WP_query
- get_post_meta for Custom Post Type ( CPT )
- Query Custom Post Type by Tag
- Complex Custom Loop with Includes
- Impossible to get Attachments Outside WordPress?
- WP_Query search posts by custom post type and custom taxonomy
- Why does using WP_Query inside a shortcode in an elementor page cause the arguments for WP_Query to get malformed?
- Unable to get post content from custom post type loop
- Lists Posts from CPT that match the Title of the Page
- Help Structuring Query for Archive Pages
- Display custom field of specific post where post title matches variable
- Conditional to modify query results
- Loop on front-page.php
- How to count custom post types with conditional operators
- wp_query to find posts by year and month
- WP_Query is printing out only one post when posts_per_page is set to multiple
- WP Query to displaying date and posts for that date?
- Create a random unique 6 digit number as custom field for custom post type
- Remove duplicated values from a loop
- Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
- Custom Post Type Loop within Shortcode
- Can’t get order_by meta_value_num to work properly
- WP_Query | ‘post_type’ doesn’t work
- How to connect two custom post types with nested loops
- Filter by custom taxonomy slug on a custom post type
- Query custom post type in the loop
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- Loop through Custom Post Type, and then show children within each iteration
- Can I create a loop with multiple post types and specify different $args for each post type?
- Display CPT posts based on specific taxonomy
- WP_Query orderby modified to include custom meta changes
- Custom Post Type Loop throws 500 error when used in widget
- Query/list all terms and their custom post count
- Show one item per category of a custom post type
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- CPT + CMB2: data not displaying for only first post in loop
- How do i calculate the total of values of custom fields in custom post types?
- Custom loop with multiple taxonomy queries
- I would like to have different styles for my posts based on the content of each post
- Checking if Post Title is Unique as Loop Criteria
- Custom Tag Description unable to display just below and outside of the Loop
- creat filter with wp_query
- What’s the WP way to load remaining custom posts?
- WP Query with categories only shows one post and ignores the category
- Problem: wp_query outputs all images on site
- How to fetch posts that are stored in the different table than (default) wp_posts?
- Cant’ Display Custom Post Type Title Base on Tax Terms
- Loop for custom-post-type comparing taxonomy terms for “related” posts?
- How do I list a custom field and custom taxonomies for each result in a loop?
- Custom Post Type Query W/Category Dropdown
- Multiple custom post type queries causing wrong post types to be grabbed in taxonomy + single templates?
- How can I increase the post count for custom post types only?
- Custom post type pagination error
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- Show the categories the current post has
- What is the most efficient way to execute recursive complex queries?
- Fetch data from two custom post types and create multidimensional array for output to html table
- CPT loop doesn’t seem to account for post date?
- posts_per_page in custom WP_Query does not override “Reading” settings?
- set object terms after some some time of published post – functions.php
- Alike Shortcode using in Custom Shortcode
- Query custom post type that has a serialized relational advanced custom field value
- Exclude a specific post in a Custom Post Type
- Pin posts to top of custom loop
- display post count in archive page that have relation with another taxonomy term
- Pagination not working in custom post type. Help
- Sort custom post column by generated value?
- Filtering posts based on three taxonomies
- Pagination Not Working When Used With WP_Query() `offset` Property
- when looping through custom post data not appearing
- Order posts alphabetically with numbers but some of the posts has numbers in the title
- WP_Query – How To Query Only Custom Posts With No Children of Their Own?
- wp_post_delete is deleting all offices
- SEARCH QUERIES – REVERSE OUTPUT
- Accessing download link from the loop with WP Download Manager Pro
- Custom Post Type has wrong label and is not found when called by a loop
- Combine multiple separate lists into one
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- Error in the page of a CPT file in WordPress
- Looping to organize and display custom posts by category using PHP and WordPress
- Tell wordpress to show a single page instead of an archive page
- post_type incorrect for custom post type
- Search result based on URL
- Staggering featured post using ‘sticky’
- Wrapping an unknown amount of posts inside separate HTML Containers during WP_Query loop
- Show parent category and subcategory once in while loop
- subtracting the current post form then whole loop, which is generating all CPT titles
- Custom Taxonomy – fields
- Custom Post By Category
- Mix Facebook and Twitter feed into custom posts
- WordPress trying to query two custom types to get child from the parent