how to show all untagged posts in wordpress

over on I was having trouble keeping track of which posts had been properly tagged or not. using this code, you’ll be able to display the untagged posts. And edit button will appear when appropriate.

Please note this is a custom page template, so just create a blank text file, rename it “untagged.php” and upload it to your theme directory.  then just create a new page through wordpress and tell it to use the “untagged” template!

Template Name: untagged

<br />
<hr />
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
<br />
<div style=”text-align:center;font-size:31px;”>
<?php posts_nav_link(‘ · ‘, ‘previous page’, ‘next page’); ?>
<br />
<center><?php if(function_exists(‘wp_pagenavi’)) { wp_pagenavi(); } ?></center>
<br />
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>

$tag = get_the_tags();
if (!$tag) { ?>

<a href=”<?php the_permalink() ?>”><?php the_title(); ?>
</a> – – <?php edit_post_link(‘[Edit]’); ?><br />
endif; ?>


please note the large number of posts that will be shown. Since it’s only the post titles that are loading there shouldn’t be a problem with 500 of them at once, but your server may not be the uber powerhouse that mine is 😉 Another quirk of this bit of code is that each page is 500 posts of your material, and it only shows the ones that are untagged. so if you have untagged posts that are 4,000 posts back, you’ll need to click over to page 8 or 9 to see those posts pop up on this.

Leave a Reply