You don’t need a select statement to do this, a DELETE
statement can handle finding the records. Make sure to backup your database first, then try the following SQL query.
DELETE FROM wp_postmeta
WHERE meta_key = 'cb_full_width_post'
AND meta_value != 'nosidebar-narrow'
Related Posts:
- Lack of composite indexes for meta tables
- Safe to delete blank postmeta?
- delete unused postmeta
- Save both current and new version of post meta
- Triple meta_key on custom SELECT query
- How to get the total number of meta_values based on a custom post type?
- MySQL Query To Select Post By Postmeta
- delete duplicates wp_postmeta
- why is my postmeta table is so heavy
- Display multiple meta_key/meta_values by single SQL query
- Using mysql queries to delete custom post types based on meta_value
- Export posts with postmeta without ID?
- How do I retrieve the slug of the current page?
- Most efficient way to get posts with postmeta
- How to extract data from a post meta serialized array?
- How to save an array with one metakey in postmeta?
- WordPress is stripping escape backslashes from JSON strings in post_meta
- How to update_post_meta value as array
- What’s the point of get_post_meta’s $single param?
- Get a single post by a unique meta value
- Content hooks vs User hooks
- Migrating non-WordPress CMS to WordPress, lots of data to move — possible solutions?
- get_post_meta – get a single value
- How to solve slow WordPress site caused by attachment_metadata
- Can I safely delete a record, manually, in the wp postmeta table?
- get_post_meta / update_post_meta array
- Delete all post meta except featured image
- update_post_meta not adding anything.(Nor add_post_meta)
- Delete duplicate rows from wordpress database where a column is duplicate in phpmyadmin
- Identifying Importer Posts
- Add a post metadata if only the key and value does not exist
- How metadata API works?
- Use ajax to update_post_meta
- How to sanitize post meta field value?
- Post IDs missing on delete_postmeta action hook
- How trigger to save post when updating post meta
- Create a Metabox that behaves Like a Taxonomy Box
- Views count with time limit per IP
- order by multiple meta_keys?
- conditional function to change post-meta background image
- echo image caption
- get_*_meta doesn’t always return an array
- Generate multiple goo.gl shortlinks for qtranslate bilingual blog
- Using hook to use DISTINCT in a wp_query
- How can I convert postmeta from unserialized to serialized?
- add_post_meta adds meta to one more different post
- Custom query, multiple custom keys
- Trying to get property of non-object error using get_post_meta()
- How can I change the tag contents of individual WordPress posts?
- get_post_meta producing white screen of death
- update_post_meta not working in plugin
- Look up all posts by status or meta value – performance difference
- String taken from database table post_meta is showing HTML tags on Frontend
- Can A Post Meta Field Store multiple values that are not in an array?
- esc_attr on get_post_meta [closed]
- Sort custom posts in archive by multiple values: date AND meta key
- Delete posts based on post meta data
- How is the author’s name given a different color?
- How does WordPress treats attachments metadata in post content?
- URL to Post Meta [closed]
- update_post_meta() adding bits in database [closed]
- Get posts ordered by meta data
- Displaying values from related field – if empty shows current post type’s link and title
- get_post_meta inside echo [closed]
- WordPress postmeta: Store data as an array or single item?
- Display Post Meta in Header
- Array of user ids to list of user names
- Conditional For get_the_author_meta
- Custom fields or something else
- Is there a way combine posts meta_name?
- How to avoid saving empty data to sql while using add_meta_box
- I want to Add Feedburner Right After Meta Details
- if get_post_meta function returns empty – Do Not Display HTML
- Custom column on CPT not showing correct value when meta data not set
- How to access post meta on the first time a post is published
- Removing Malware
- I Can’t get the post_tag name from term_id using wp_set_object_terms
- After updating the custom post type, metafields disappear from the post.php edit menu, how do I fix it?
- How to update/add child posts meta whenever the parent post meta is updated?
- How to query post with meta?
- update_post_meta() throws Uncaught error: Cannot create duplicate attribute
- Using a comma instead of a pipe to separate metadata
- show user based on user_meta
- Meta keys won’t add using wp_insert_post
- How Can I extract Image urls from post meta
- Assign postmeta in bulk
- How do i get value from wp_postmeta?
- Twenty Twelve entry meta data – change and move
- Re-order posts inside tax query
- How can I prevent the post_modified column in wp_posts from being updated?
- Sorting meta box values by start- and enddate and all dates in between
- Use an id on a button to update_post_meta in post
- get_post_meta image width for lazy load
- Custom Fields help
- WP-API : post_meta not updated… but have another entry
- Parse error thrown by get_post_meta [closed]
- How to get all the related ids without array?
- Remove action of an external plugin after checking if custom post meta is set
- I am stuck between post meta function to call unique id
- get_post_meta() returns nothing in save_post, publish_post, wp_after_insert_post