I ended up figuring it out. I installed the wordpress plugin “Query Wrangler” which helped me build exactly what I was trying to figure out. What was the missing key was instead of the value being ” on the post where the custom field didn’t appear, I should have put ‘0’.
Here’s the final working code:
$args = array (
'paged' => 1,
'posts_per_page' => '-1',
'offset' => 0,
'post_status' => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit'),
'ignore_sticky_posts' => 0,
'orderby' => 'date',
'order' => 'DESC',
'post_type' => 'speakers',
'meta_query' => array (
0 => array (
'key' => 'speaker_promo_image',
'value' => '0',
'compare' => '!=',
'type' => 'CHAR',
),
),
'meta_key' => 'speaker_promo_image',
);
Related Posts:
- Multiple orderby values in WP_Query
- WP_Query orderby custom field then post_date in one query
- how to filter by last name for custom post
- Filtering a WP_Query meta_query by numeric values isn’t working
- Sorting a query by custom field date
- How can I generate a RSS feed based on a custom WP_Query?
- Filtering a WP Query result
- Display Custom Post Type Fields
- Add custom field to media attachment image attribute in post editor
- Search Custom Post Type with all meta attached?
- How to sort CPT by custom meta value (date), and return posts month by month
- WP_Query on custom post type not displaying, multiple loops & get_template_part
- Using new WP_Query in shortcode in a custom field causes the main post content to not display
- WordPress query by multiple Custom fields and order by date
- Comparing timestamps in meta query doesn’t work
- Display two post types ordered by two custom fields
- Get post info inside modal window?
- WP Query group/order by category name
- Stopping WordPress from Auto Generating Image Files for Sizes
- Having trouble with custom date field for CPT query (WordPress)
- Display posts if a custom field value is equal to another custom field value
- Sort by two dates. Default entry date and custom field if present
- Impossible to get Attachments Outside WordPress?
- Conditional to modify query results
- Filtering by Post Meta Custom Fields – Performance
- wp_query to find posts by year and month
- WP Query—Relationship between two custom post types and their fields
- How to dynamically attach pictures to a carousel
- Get all Posts If has same custom field values in Posts
- Custom Post type and Custom Field WP_Query
- Including Custom Meta with posts_where query
- WP_Query orderby modified to include custom meta changes
- WordPress custom loop filter by meta_key and value with serialize data
- Returning a list of custom post types excluding those without a specific meta_value
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- wp_query check if integer exists in custom field’s array
- Problem querying Custom post type by custom fields
- WP_Query order by custom field, then randomly order some of results
- Including metaboxes from custom post types in global search — continued
- Query Multiple Custom Posts by Custom Fields
- Get Posts by multiple custom fields is not working
- First custom field value (out of several) displayed twice after query
- Query based on custom fields start and end date
- DIsplaying URL of custom field in last post of certain taxonomy && post type
- Add post meta programmatically to attachment
- WP Query ‘posts_per_page’
- Display post from a date range from custom field
- post_per_page ignored in WP_Query
- How to get specific post meta by title or id
- Getting a custom post’s custom field based on another custom post’s custom field select
- WP_Query orderby not work with meta_key
- Having Issue on Ordering CPT by Custom Field In Custom WP Query
- Display custom post type for specific user
- Custom Post type loop with ACF not displaying properly
- Group by custom field value (start and end times)
- Let users upload image(s) to the post from front end
- Cache issue with WP_Query and custom field filtering
- WP query_posts group by meta field related
- Custom Form / Search with Custom Post Type Data
- Create if else for post types in WP_Query ‘post__in’ values
- WP Query from two Custom Post type fields as statement
- Alike Shortcode using in Custom Shortcode
- WP Admin Dropdown List Filter for custom (ACF) field on custom post type(s)
- WP_Query get always custom post_type for first
- Sort custom post column by generated value?
- Filter posts by their related field’s custom field
- How can I fetch all the dates from custom fields from various different custom post types and show / list them at one place in ascending order?
- Query custom post type and custom field by URL parameters
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- Query a Custom Post Type using SELECT that has ACF fields to compare dates
- meta query multiple values for the same key
- Sort custom post archives by a meta value from a different custom post type?
- Custom post types – meta_query: search lesson which starts sooner
- Post Filtered by Custom Field Value
- Filter custom WP_Query by first letter of a custom field – hopefully using Search and Filter Pro?
- sorting in wp query based on custom field value
- Meta_Query refuses to return results
- WordPress loop add heading before first of type
- How to make a shortcode for my WP_Query Loop? [duplicate]
- Query events post type after current date and timezone
- Delete custom post type metadata without deleting the post in admin area
- Calling specific page with wp query
- How to stop wp_query searching pages as well as the specified CPT
- Selecting posts older than the current Unix epoch timestamp
- WP_Query and two custom fields returns no posts
- WP_Query get posts where post_name is empty
- Storing/querying custom date data
- Query recent posts by author
- 404 on Pages for Custom Post Type & Query_Posts
- Querying meta values within an array
- Filter Custom post type by another Custom post type
- Show Posts in Vertical Tabs with Scrollbar
- How to show all posts of specific custom post type with their custom fields values?
- querying to custom field over ACF REST API
- Display ACF object field data using Elementor Custom Query
- WordPress custom field sorting, weird behavior: the latest post is at the end
- Sort CPT by taxonomy AND THEN by custom field
- WP Query + custom fields: How to query event posts from the current date backwards 6 months and organize it month by month?
- Query order by a numeric ACF field
- WP_Query not using relation key as expected and not producing any results