Many times, you often want to delete posts by post meta in WordPress and you couldn’t find any plugin for that, In that case, you need to run SQL query from your PHPMYADMIN. Today we will discuss how to delete posts by post meta in WordPress.
I’ve created a custom SQL code from that you can easily delete the posts by post meta.
Here is the sql query to delete posts by post meta
DELETE p, pm
FROM wp_posts p
INNER
JOIN wp_postmeta pm
ON pm.post_id = p.ID
WHERE pm.meta_key = 'your_meta_key'
AND pm.meta_value = 'your_meta_value';
Here wp_posts is post table and then I’ve added the join in post meta table(wp_postmeta). in where condition I’ve added the meta_key that is the post-meta key and value. Please note that you can add your key and value.
Conclusion
All you just need to copy the code with a single click and then paste in your PHPMyAdmin and change the values. you don’t need any plugin for it.
If you like the article and this article solve your problem, then share it with your friends, it’s free 🙂
Check out other articles on WordPress too.
-
How To Redirect To Another Page In PHP
In this tutorial we will learn how to redirect to another page in PHP. Moslty, we see when user login or register then site make user redirect to another page. Today, we will learn how to do the redirection once user fill the form. How Redirection Works in PHP In PHP when you want to […]
-
How to start Blogging in WordPress for free in 2022
Are you looking for start blogging today and you don’t have idea how to start blogging. WordPress is an excellent choice for you because first of all it has wonderful supports of lot of free themes and plugins, 90% blog sites built with WordPress
-
Top 7 best themes for wordpress
WordPress is great CMS(content management system) for blogging. and There are thousands of themes available for blogging, ecommerce, business website. Some of them are free while other are premuim themes, making it hard for beginners to choose between all the different options. The best theme is that can easily be customizable, light-weight.
-
How To Redirect To Another Page In PHP
In this tutorial we will learn how to redirect to another page in PHP. Moslty, we see when user login or register then site make user redirect to another page. Today, we will learn how to do the redirection once user fill the form. How Redirection Works in PHP In PHP when you want to […]
-
How to start Blogging in WordPress for free in 2022
Are you looking for start blogging today and you don’t have idea how to start blogging. WordPress is an excellent choice for you because first of all it has wonderful supports of lot of free themes and plugins, 90% blog sites built with WordPress
-
Top 7 best themes for wordpress
WordPress is great CMS(content management system) for blogging. and There are thousands of themes available for blogging, ecommerce, business website. Some of them are free while other are premuim themes, making it hard for beginners to choose between all the different options. The best theme is that can easily be customizable, light-weight.