Forums

Use query_posts() to exclude an author (2 posts)

  1. vital101
    Member
    Posted 2 years ago #

    Hey everyone,

    I have what I thought was a simple request. I need to exclude an author from the posts page. I know this seems weird, but this particular author I use to upload video content, and I don't want that content on my posts page. So far, I've tried to use query_posts() to make it work. Before the loop, I put:

    <?php query_posts('author=-4'); ?>

    This successfully removed the said author from my posts page. However, when I go to the bottom and click "Older entries", it doesn't do the paging correctly. It just gives me the same list as on the first page. I'm assuming that the page number needs to be fed into query_posts(), but I'm not sure how to do that. Any ideas?

    Thanks,
    vital101

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    Might try something like:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('author=-4&paged='.$paged);
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic