Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Pulling by DESC – Next pages not working

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #193337
    amidigital
    Participant

    I changed this…
    ‘orderby’ => ‘rand’,

    to this…
    ‘orderby’ => ‘DESC’,

    It now pulls in DESC order. But when I go to Next Page it just gives me the same post on every page.

    <?php query_posts(array(
    ‘showposts’ => 15,
    ‘orderby’ => ‘DESC’,
    ‘category__not_in’ => array(239,1,22471,1669594,1669650, 1345204)
    )); ?>

    Thank you!

    #193338
    Anonymous
    Inactive

    From the codex:

    Note: This function isn’t meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. query_posts() is overly simplistic and problematic way to modify main query of a page by replacing it with new instance of the query. It is inefficient (re-runs SQL queries) and will outright fail in some circumstances (especially often when dealing with posts pagination). Any modern WP code should use more reliable methods, like making use of pre_get_posts hook, for this purpose.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.