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
- How do you get the count of posts in an archive page?
- WP_Query to loop a Custom Field, Custom Post Types do not show
- Using new WP_Query in shortcode in a custom field causes the main post content to not display
- How to show posts from multiple post types in a single loop? And display them separately on the same template
- Get count of custom post type created by current user
- exclude custom post type by meta key in wp_query
- Query Custom Post by Category
- How to append element after thumbnail
- WP_Query and using a variable for ‘cat’=> in the args array = WP Bug?
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- 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
- Display custom field of specific post where post title matches variable
- How to count custom post types with conditional operators
- Remove duplicated values from a loop
- How to connect two custom post types with nested loops
- 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
- CPT + CMB2: data not displaying for only first post in loop
- Custom loop with multiple taxonomy queries
- Custom Tag Description unable to display just below and outside of the Loop
- creat filter with wp_query
- Problem: wp_query outputs all images on site
- Configuring a meta query with multiple post types that have the same relationship on a single page
- Including all post id’s of a custom post type into an array
- Multiple Custom Post Type queries, how to DRY it up
- Custom WP_Query doesn’t display all posts
- Query & the_content() is showing in the header
- Is This Code Efficient – Or is there a better way?
- Pagination not working on custom query on a page
- Undefined $post in wp_query
- List latest post out of 2 custom post types
- How to count other posts not having specific taxonomy terms?
- List all Custom Post Type posts excluding certain Taxnomy term
- 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
- Fetch data from two custom post types and create multidimensional array for output to html table
- posts_per_page in custom WP_Query does not override “Reading” settings?
- 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
- Pagination not working in custom post type. Help
- Filtering posts based on three taxonomies
- 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
- Error in the page of a CPT file in WordPress
- post_type incorrect for custom post type
- Staggering featured post using ‘sticky’
- Show parent category and subcategory once in while loop
- Custom Taxonomy – fields
- WordPress trying to query two custom types to get child from the parent
- How to get the posts that my following users are liked?
- CPT post doesnt shows tags and category on backend admin page
- Display related post content and custom field content
- The most recent post of custom taxonomy
- WordPress query in which condition uses custom field
- Error in WP Query. If variable is empty it is displaying previous post value
- For each 3 posts, show a different post type
- How To Loop Through list with Custom Post Types
- Custom Post Type + Category archive
- Post data in separate divs with incrementing class using WP_Query
- Values inside a custom field to determine which category posts to display
- Posts without featured image using other post’s featured image
- Order by custom field attribute
- next_posts_link returns same content of 1st page
- Custom loop won’t work, can’t find problem
- Custom post-type’s pagination not working in category.php
- How do I correctly query posts from a post ID?
- display custom post type from register taxonomy
- How to exclude certain portfolios from a loop
- Custom post type and have_posts() return empty result
- Store custom post type with JSON content
- How can I show posts with the same tag?