php - How to find untagged posts on WordPress?
i have some untagged posts , and i can't find an option that can list all my untagged posts so i can delete them .
i've read some article about that and they say that i need to do some change to wp_query , but i'm not familiar with php , i know some basic coding stuff but not php , i want someone to explain how i can do it , so i can list all my untagged posts
i found this code :
$tag = get_the_tags();
if (! $tag) {
echo 'this post has no tags ' . /the_permalink();
}
i found it in : https://wordpress.org/support/topic/how-can-i-list-all-the-posts-that-have-0-tags?replies=5 , but the problem is 'm not familiar with php , so i don't know where to put the above code , can any one help ??
Answer
Solution:
That is not the best way to get posts that have no tags. Also notice the dates of the posts in that link - 7 years ago! That is definitely SIGNIFICANTLY out-of-date.
Have a look at this WordPress StackExchange post which shows you how to get retrieve tagless posts using
wp_query
with thetax_query
option: https://wordpress.stackexchange.com/questions/114978/get-all-posts-without-tags