Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Reorder posts in Query block with Post Meta Query Type

  • I have 2 custom post types (staff, testimonials) with an AFC relationship. Testimonials are displayed on the staff page using a Query block using the Query Type of Post Meta. By default the oldest testimonials are displayed first, but I want to display the newest testimonials first. However, there is no ‘Add Parameter’ button for the Post Meta Query Type.

    Can the Add Parameter button be added? Or is there another solution?

  • Hi there,

    By default, when you retrieve posts from an ACF Relationship field, WordPress respects the order in which they are stored in the field (post__in order).

    So no, when the query type is set to post meta, it respects the order of posts in the field.

    The only workaround I can think of is to set the query type to Post query, and use PHP code to pull the posts from ACF field.

  • Bummer, that severely reduces the functionality of retrieving posts from an ACF Relationship field. I assume the answer is no, but is there a way to at least reverse the order of the posts?

  • Hi there,

    Right now, the only solution is to use the workaround suggested by Ying. I believe custom parameters for Post Meta query are planned, or at the very least, a filter should be available for it. I’ll check with the dev team.

  • Thank you Alvind! That would be great if custom parameters are planned or if a filter was a possibiliy!

  • You’re welcome! I’ll update this topic as soon as we have any new information on that.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.