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.
-
What is a Backlink in SEO? How to get Free Backlinks?
ADVERTISEMENT ADVERTISEMENT A backlink is one of the most used words in the world of SEO. In this post, I hope to offer you an understanding of what is backlink in SEO and free ideas to get backlink for your website or blog. Many bloggers who have only recently started a blog or a website […]
-
How to Duplicate a Page in WordPress?
WordPress duplicate a page: WordPress allows users to duplicate a page and post in more ways that just by copying and pasting the content. In this article, we will talk about the reliable ways that will help you to duplicate pages or posts of your WordPress site. You can done this job with and without […]
-
What should be the first tag in any HTML document?
There should be <html> in the first tag in any html document. It will let the web browser know that it is an HTML file. Otherwise, there is no chance that the browser will know that it is an HTML file. And all the other options are tags that have to be used later after […]
-
What is a Backlink in SEO? How to get Free Backlinks?
ADVERTISEMENT ADVERTISEMENT A backlink is one of the most used words in the world of SEO. In this post, I hope to offer you an understanding of what is backlink in SEO and free ideas to get backlink for your website or blog. Many bloggers who have only recently started a blog or a website […]
-
How to Duplicate a Page in WordPress?
WordPress duplicate a page: WordPress allows users to duplicate a page and post in more ways that just by copying and pasting the content. In this article, we will talk about the reliable ways that will help you to duplicate pages or posts of your WordPress site. You can done this job with and without […]
-
What should be the first tag in any HTML document?
There should be <html> in the first tag in any html document. It will let the web browser know that it is an HTML file. Otherwise, there is no chance that the browser will know that it is an HTML file. And all the other options are tags that have to be used later after […]