Support » Fixing WordPress » Pagination not Working with WP_Query

  • Resolved InkInspector

    (@inkinspector)



    Hello, everyone.

    For some days I have been pulling my hair to make this work. Today I gave up.

    This WP_Query should be accompanied by a pagination, but it does not appear. The posts are loaded correctly. Here is the code on Pastebin: http://pastebin.com/PvWGvX4z

    In another attempt, the pagination appeared, but the page 2 loaded the same posts of page 1.

    Does anyone have any tips?

Viewing 1 replies (of 1 total)
  • OK, I managed it to work.

    In a Stack Exchange post I discovered that my $query = new WP_Query( $args ); should be $wp_query = new WP_Query( $args );, in a mandatory manner, even that the Codex gives an example using the_$query = new WP_Query( $args );.

    It seems that the variable which receives WP_Query must be $wp_query.

    I hope this helps someone in the future.

Viewing 1 replies (of 1 total)
  • The topic ‘Pagination not Working with WP_Query’ is closed to new replies.