• I have the following coding on my sidebar to display 5 randomly chosen posts.

    <?php
    $args = array( 'posts_per_page' => 5, 'orderby' => 'rand', 'category__not_in' => array(1, 2, 3) );
    $rand_posts = get_posts( $args );
    foreach( $rand_posts as $post ) : ?>

    This is working fine on most pages. But on category pages, it shows many many many posts starting from the most recent.

    What have I done incorrectly?

    -E Morris

    example of 5 random posts displaying correctly: etherwork[dot]net/blog/ << please leave this unlinked.

    example of 5 random posts displaying incorrectly: category page: etherwork[dot]net/blog/category/hunger/ << please leave this unlinked.

    My WP has only just recovered (I hope) from a bruteforce attack

  • The topic ‘randomly chosen posts on sidebar displaying incorrectly’ is closed to new replies.