Thats because you created the meta_query property incorrectly, it should be a multi diminsional array.
$pet_owners = new WP_Query([
'post_type' => 'pet_owner',
'posts_per_page' => -1,
'meta_query' => [
[
'key' => 'pet',
'value' => 'cat',
'compare' => '!='
]
]
]);
For more information about meta_query see Custom Field (post meta) Parameters
Related Posts:
- WP_POSTMETA – What do these values mean inside the data structure?
- I can not display meta value in extras.php and template-tags.php
- Multiple meta key and value search in the query
- Meta compare with date (stored as string) not working
- How to get all term meta for a taxonomy – getting term_meta for taxonomy
- How metadata API works?
- Job of meta_key meta_value fields in database tables
- order by multiple meta_keys?
- How to get the total number of meta_values based on a custom post type?
- How to stop wp_postmeta from being called on archive and search pages?
- How can I convert postmeta from unserialized to serialized?
- How to create a meta_query to get all posts with a specific meta data?
- Compare meta_query with a Regular Expression and do a less-than operation on it
- $wpdb class updating meta_value using Ajax [closed]
- Should I save this mulit dementional arary as one post meta?
- How to check if a post meta key/value pair already exists for a specific post
- Order by meta value pro first then meta value free in my search function
- why after saving meta value it’s saving all the values the one that i clicked?
- Is it safe to add a new field to meta_value field?
- How can I use ‘orderby’ => ‘meta_value_num’ to order by the numerical value even if the value starts with a word?
- get Insert id for meta field
- Filter posts by meta key
- Display current ranking of post as a number in post title
- Search post overlapping dates – meta_query with meta_key
- How can I query for posts using a date stored in post-meta?
- Count Post and Page Views based on meta_value Using Shortcode in Dashboard Widget
- if get_post_meta function returns empty – Do Not Display HTML
- How to get posts by meta value as multi-dimensional array?
- How to get the total of two meta values from different meta keys?
- How to save a meta_value as a numeric value after I retrieve it via update_post_meta?
- How to update/add child posts meta whenever the parent post meta is updated?
- Combine meta query and give a specific meta query a higher priority
- Optimize WP Meta Query for large amount of post meta?
- Multiple postmeta values to the same post_id/meta_key combination?
- How to sort by meta value num, but ignore zero value?
- Retrieve posts from meta key
- How to show specific meta keys of all posts in admin panel?
- How to create a link for wordpress meta datas?
- How we insert values into database using metabox WordPress?
- Check for custom field value in different post type than current one and do something
- WP Query Args – search by meta_key or title
- Update post meta array – add new, single value
- How to only display posts whose meta_value field is not empty?
- Check if Post Title exists, Insert post if doesn’t, Add Incremental # to Meta if does
- How to update/insert custom field(post meta) data with wordpress REST API?
- Custom Queries: Joining On Meta Values From Two Custom Post Types
- Front-end update_post_meta snippet displays white screen?
- WordPress Admin Panel search posts with custom post meta values along with title
- Get post from meta_key and meta_value
- get_post_meta returns bool(false)
- How to get custom post type to display post meta on archive pages?
- How to use post_id with a Class?
- Query metas (and not : query posts by metas)
- Set default Custom Post Meta Value
- INSERT ON DUPLICATE KEY UPDATE failes in postmeta table
- Advanced Meta Query for Large Calendar Website (12k+ posts) (175k+ wp_postmeta rows)
- Set Checkbox as checked by default
- Query multiple meta values
- replacing the_autor or make callback
- Some post meta fields stop saving after a few successful saves
- Save an array of values in the post meta box
- get_post_meta() empty in preview WHEN custom post is published [closed]
- Permalink structure with $_SESSION variables
- get_post_meta not extracting title,permalink and posttype
- WordPress Screwing Up ‘orderby’ => ‘meta_value_num’ in ‘pre_get_posts’
- Query posts according to specific post meta values
- Save post meta foreach loop
- Remove last character in get_post_meta
- mass delete posts based on metadata
- Duplicate rows in meta table, any known relations in WC?
- Adding Custom MetaData
- Suggestion to make posts have multiple associated items
- update_post_meta in loop changing ALL values
- Why is my get_post_meta not properly calling the custom field when attempting to embed a YouTube video?
- Nested array issue in meta_query
- How to echo value of a meta select box to the browser
- WP_Meta_Query object with conditionals
- How do I add a fixed value to get_post_meta();?
- Add post’s category as a meta tag to the post
- Is duplicate `_wp_attachment_image_alt` meta key allowed?
- How do I list taxonomies that have upcoming events in WP? Is there a way to do this without having to query posts first?
- Strict comparisons problem when using boolean post meta
- Why is the actual number of thumbnail images not matching what is store in an attachments metadata?
- How to use multiple Meta Field from CPT as Post permalink
- Set class if a meta value is set within post archive
- show most viewed post
- Get table parameter and save in meta value
- How can i show post views using specified post ID?
- How to add/update post meta to use in query?
- Is there any way to get all custom posts and all custom terms with it’s meta in few queries?
- Move Entry Meta Above Title in Archives (Genesis + Brunch Pro)
- Exclude category from DB query
- Update event post meta each day automaticaly
- Advanced Custom Field — grabbing post_meta from previous post
- Fetch post meta data on POST request
- Which query method to use? (edit- wpdb syntax problems)
- How to update post meta with xml data
- wp_postmeta store multiple values in one key [closed]
- get Custom field label (select/dropdown) on front end
- Hide individual page title using checkbox in custom meta box?