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 increase memory limit in wordpress
wordpress is the most popular blogging platforms around the world. It’s become popular over the years, and it continues to grow. WordPress powers millions of sites and blogs, and it’s also a great solution for building custom web pages.
-
create custom post type in wordpress in 2022
Do you want to learn to create custom post type in wordpress? There are 2 methods for that one with plugin and other is without plugin. Both methods are easy to use, but some require more work than others. Choose whichever method you prefer.
-
Why website is important for your business in 2022
One of the most important strategy for a company is to create a website. It’s true that a website can affect how much revenue you generate.In this article, we will explore why websites are important for online marketing. Different types of websites may have different goals. but in general, websites are used to share information or engage with their audience. Websites can be used as a tool by businesses to advertise their product and/or services online, as well as engage with their customers via email, social media, and other platforms
-
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.