You’ll have to use JOIN to achieve this:
UPDATE wp_posts p INNER JOIN wp_postmeta pm ON p.ID = pm.post_id
SET p.post_status="draft"
WHERE p.post_type="match" AND pm.meta_key = 'played' AND pm.meta_value = 0;
Related Posts:
- delete custom post based on custom field date
- 1 day after custom date change post status to draft
- How to import database table as custom post type and custom fields?
- Populate custom post type/custom fields from an external database
- Help Creating a Slideshow Custom Post Type with Custom Meta Boxes?
- Custom field values deleted when trashing custom post type
- Search multiple custom fields by using meta_query
- Custom Post Type – Taxonomy Dropdown Menu?
- How I check if the same post slug has not been used before publishing?
- How to sort a table of custom posts by column containing custom field
- Issue with saving custom post type when editor is removed
- convert Custom Fields Option-Values to Tags/Taxonomy
- Combine tax_query and meta_query in WP_Query
- Automatically Insert Custom Field on Custom Post Type Publish
- Display custom post types with custom date field value (before today) & order by custom date field
- How to have the right design for a custom post type without accessing themes
- How to add the post ID (or any other post data) to a Contact Form 7 mail?
- WordPress custom meta field for custom post not storing data
- Conditional regex in add_rewrite_rule() for specific query filters & pagination
- How to Duplicate (multiple meta box)?
- $wpdb: Counting posts corresponding to 3 terms in 3 different taxonomies
- List all images from a single post meta value
- WP_Query: include custom post type only with specific meta value
- Is there a way to get a file URL from the relationship ACF field?
- Want to Add Custom Fields for Uploading video to WordPress Users from front end
- How can I dynamically add a post to a custom post type which uses a custom field?
- Custom Posts Types as Custom Fields
- Random image from tag/custom type on sidebar
- Query & Order posts by custom fields
- Set a maxlength for the title input in a custom post type
- Update Post Meta for a logged in user
- Problem querying Custom post type by custom fields
- Using custom field content as expression in IF statement [closed]
- ACF From & To Date Validations
- Query Multiple Custom Posts by Custom Fields
- Disable saving posts as draft (make all posts mandatory regardless of the post status)
- Woocommerce custom field search in custom post type [closed]
- Custom REST endpoints for a custom post type with custom fields
- Cross reference custom post types
- frontend image post uploader
- Show fields based on taxonomy selection in editor
- Permalinks: custom structure for taxonomy – tags?
- How to Get the title of a custom field?
- Create custom post with meta field with AJAX and the WordPress REST API
- How to customize work area / admin area in a custom post type without plugins?
- ACF in wordpress
- Creating custom post type with custom taxonomy and custom fields programatically
- delete_post_meta() for whole CPT / multiple posts?
- How to inherit field value from parent post into in child / sub post
- hide specific div on single.php [closed]
- How do you output an unknown number of images in a custom post type with desired markup?
- posttype and custom fields on multisite
- Custom Fields not showing up for custom post type
- Custom post type in Custom widget – $listItem
- Generating and downloading files with WP API
- New post from database
- Convert Custom Taxonomy Posts to Normal Posts
- Displaying information from custom field on custom post type
- Add a class to post_class if more than one post shares same meta_value_num
- Add a meta field to the list of results for a custom post type
- Order custom posts by taxonomy, then by meta_key
- Adding a Custom Field to be used by Posts 2 Posts
- How do I list a custom field and custom taxonomies for each result in a loop?
- Custom fields for post or terms which don’t update on post update
- order the meta query results by 2 custom fields
- ACF – Retrieve custom taxonomy from a relationship field
- how to skip a CPT element from the pager by custom field
- How to Print Title and Permalink of CPT Post behalf of Posts Meta Value with WP_Query
- Updating a custom post status after an expiry date rather than trashing it
- Meta query and compare “!=” not working as expected
- How to add dynamic fields on wordpress custom post type page in admin section
- How can I add a meta[] to my custom post type and search by term with the Rest API?
- Creating an archive page or simple template to list all values of a custom field of specific post type listing
- Problem with multi checkboxes value in metabox?
- Filter custom WP_Query by first letter of a custom field – hopefully using Search and Filter Pro?
- Dropwdown: Get taxonomy terms from posts that share preselected terms from 3 other taxonomies
- sorting in wp query based on custom field value
- check_admin_referer not working in custom meta box for custom post type
- WordPress loop add heading before first of type
- How do i create user accounts from custom posts that have email addresses
- How to display all custom fields associated with a post type – IN THE ADMIN AREA?
- Best way to use Category & Custom Fields?
- How do I add custom fields to posts without having to manually add everytime I post?
- How to display custom post type ordered by a custom field date
- Setting a custom $query->query_vars[‘meta_key’] breaks the WordPress menu
- WP_Query and two custom fields returns no posts
- Is it good practice to search for custom posts based on custom field values?
- Custom post type with custom fields enabled, is there a way to set a default group of fileds?
- Storing/querying custom date data
- I want to split this into two functions
- Repeatable Custom Field for Media Upload
- How to store datetime from custom meta box so that it can be sorted by
- Custom Post type easy way for editors
- Adding a custom field after post title (ex.Example Title [30 Second Read])
- Send email on creation of custom post type and use get_post_meta()
- pre_get_posts causes Custom Posts appear under ‘Pages’ menu
- Assign a tag to custom post type using a query
- Post object GUID adding http:/
- WordPress does not show the custom fields box
- Query order by a numeric ACF field