Try below code to delete the post_meta by a specific value of the specialized data:
$args = array(
'post_type' => 'post',
'meta_key' => 'any-meta-key',
'posts_per_page' => -1
);
$query = new WP_Query( $args );
if($query->have_posts()){
while($query->have_posts()){
$query->the_post();
$get_ID = get_post_meta($post->ID, 'any-meta-key', true);
// Change the id value that you want to delete
if ( !empty($get_ID['id']) && $get_ID['id'] == '1' ) {
delete_post_meta($post->ID,'any-meta-key',$get_ID);
}
}
}
Don’t forget to update the test meta key by your meta key.
Related Posts:
- Function to return true if current page has child pages
- Cleaning up WordPress to improve performance?
- List of all theme customizer control types?
- Build a content and excerpt grid loop with paging and options for # of posts
- How to preserve PHP modifications while upgrading WordPress?
- Set the transport of the Customizer ‘header_image’ core setting to ‘postMessage’
- the_post_thumbnail() based on the Post ID
- Change comments form title on a page by page basis
- Setting up the child theme so as to enable right-to-left WordPress?
- Why does “get_option” pull in the older value in options.php, rather than the newer value, on submission of a form?
- delete an array element when its date expires
- How can update custom meta for all posts
- How to add 2 posts under another post? Formatting should be intact
- How to add default images into theme customizer image control?
- Overriding a theme redux file in child theme
- How to display custom field on homepage
- How to break down importing of feeds
- How to Display Image Meta underneath EVERY image in EVERY post
- PHP can I add line numbers to file_get_contents()
- Use wp_get_recent_posts with search term
- Remove query string specific key value
- Get Current User Id Inside a Loop Returns 0 For a Shortcode
- Setting custom canonical urls
- Create another “Display Site Title and Tagline” checkbox, “Header Text Color” setting and control
- Advanced Meta Query for Large Calendar Website (12k+ posts) (175k+ wp_postmeta rows)
- Converting HTML Template to WordPress Theme
- How to check if a meta value has already been assigned to any user?
- Retrieve $_POST data submitted from external URL in WordPress(NOT API)
- How to prevent WP_Query function from returning all posts when empty?
- Display a specific category of products in shop page and disable code for specific actions
- Get users that likes the post
- Modify custom field input data before creating a new post
- Compare the old get_theme_mod($name) to the new get_theme_mod($name) return value
- Remove echo from shortcode
- Need help enqueueing webfonts
- Redirect to another page using contact form 7? [closed]
- Is it possible to retrieve all posts with a certain value for metadata?
- How to obtain the current website URL in my theme?
- Exclude posts with specific metadata from search?
- Function Reference Documenting Template Tags for use in Custom Theme Templates?
- Create page template via functions.php?
- How to create a field in customize and show that in header.php?
- WP_Query | IF within $args array | Help me only add specific arguments if the argument is not blank
- change the default order of posts only for specific categories
- Post not populating for custom post type based on category selection
- Custom query vars filters problem with pagination
- How do i wrap woocomerce attribute in list?
- get_theme_mod outputs number when using WP_Customize_Cropped_Image_Control
- How to get post category list as select in front-end?
- Order a WP_Query by meta value where the value is an array
- Is there a hack for using is_page() within the function.php file?
- Unable to Call More than One Meta Box Output
- Hide a div when a custom field is empty
- Displaying Event within two given time frames
- Customize field names in backend profile edit page through function.php [duplicate]
- Let current user know pending posts counts using wp_query
- How to check post meta isset or not empty during publish/save post?
- Output product category link from WP_Query
- Isn’t Returning Value While Using SELECT COUNT(*) FROM {$wpdb->prefix}
- “pre_get_posts” orderby custom date field in different format?
- WP-Bakery – Add custom colors to buttons with template colors
- How to exclude meta no index pages from wp_list_pages
- Trying to update Woocommerce meta values
- How to add and subtract user meta values after post meta update
- WP query posts BUT show the most recent and one per author
- Ajax filter with loadmore button
- update_user_meta as multiple value but with same meta key
- posts_per_page displays only 2 posts instead of 4 posts
- Modify post image in full size
- WP_Query To Display Product Of Brand On Taxonomy Page
- Remove node from multisites?
- Automatically refresh page if widget is added to page?
- Stored meta from attachment, video length?
- My query keeps looping infinitely ! how to stop it?
- Efficient way of querying for a “fallback” post?
- Where can I find the declaration of `$_wp_theme_features`?
- How do I routinely extract the thumbnail of the most recent post?
- Display Year and Month from custom field + Age Calculator
- insert thumbnail image from php script
- A Customizer checkbox control that sets the setting to “” or to “blank” and show() or hide() a color control
- Weird Behaviour: Not all WordPress Posts appearing
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- Use custom get results query to show posts WordPress
- List sibling pages widget, exclude current page
- Postmeta not saving
- Check if values exists DB
- How to get category pages to look like a certain archive page?
- get_post_meta no longer working
- WordPress causing all code to be displayed on line 1. Receiving multiple errors after cleaning cookies and cache
- How to add button to top of theme customizer?
- How can I clear the theme mod settings?
- Display a list of users with avatar filterable with alphabets
- Select area and checkbox data is not saving?
- How to modify this function to exclude also the post belonging to a specific category?
- How to display the date under the post title?
- WP Custom tables query
- Add multiple HTML attributes to an Elementor button
- a problem in class in class-wp-hook.php
- /page/2/ redirect to 404
- Add adjacent post function inside custom recent post function