Query prev & next buttons

Hi all,

Is there a way of hiding the prev button for a query if it’s the first page and there’s no previous page, and respectively hide next button if it’s the last page?
Looking through the conditions element and can’t see anything there.

Thank you.

@beleancristian did you find a solution for this?

@Louis, will there be a solution for this?
When using the “standard” Gutenberg previous/next ‘Post Navigation Link’ it hides the respectively prev/next button, but, you can’t edit these standard Gutenberg blocks.

Thank you,

Hi @beleancristian and @dennis77,

Sorry for our lack of reactivity on this.
This was introduced in 1.2.6, with the Has Next/Prev page conditions.

See this video demonstrating it: Condition Prev/Next - YouTube

Please let me know if this helps!


Hi @Araminta.
I can confirm it works as described.
Thank you.

1 Like

Thank you @Araminta, but unfortunately this doesn’t work in a single post.

Thanks for getting back to me @dennis77

Sorry for the confusion.

@beleancristian was referring to the pagination ensemble, but it seems that you are referring to the Prev/Next links, for which currently there are no conditions available.

Feel free to create a new feature request for this, so that we can keep an eye on it!

@Araminta, what is the correct button action for the Query prev and next page buttons?

Hi @StrangeTech,

Please see the screenshot below for the Query prev. and next button actions.

Please let me know if this helps!

@Araminta, thank you for the fast response.

Unfortunately I don’t have those actions available for some reason.

Can you advise if there is a specific scope the buttons need to be in or a specific prerequisite to enabling them.


The buttons are nested within the Query block, so I would have thought that was enough, but perhaps I am missing something obvious.

Sorry for not responding sooner @StrangeTech!

Your buttons will have to be nested in the Query pagination for the link actions to appear.

Please let me know if this helps.

That did the trick, thank you very much @Araminta.


Im having a lot of trouble figuring this order out.

im in a cpt single post. i want to add previous and next (nestable so i can insert elements i want). anyone have screenshots what and how to select things? ive tried with pagination wrapper but it keeps loading the same page.

You don’t need a query for this, you can use the dedicated Prev. Post and Next Post contexts for this:

  1. Wrap your button in a div:
    Screenshot 2024-01-08 at 18.18.56

  2. Add the appropriate context to the div:

  3. Set the button url to Post URL:

Everything should just work.

Thanks, can i ask, if i want an image, a heading etc to all point to that post, do i need to link each element like the button?

As long as you are within the div context, you can link as many elements as you want (just like the button), or you can wrap all of those elements in another div and link that (to note again - this works as long as this is within the context div), it is entirely up to you.