SOLVED: Load more interaction not working with meta query

I’m working on a project with the following setup: Normal posts can be connected to a specific team (CPT) via ACF relationships. For the team pages, I’ve created a template that displays ACF values and also the associated blog posts. To only output the relevant posts on a team page, I’ve used a meta query and the {post_id} (see screenshot below).

In addition to that, I wanted to limit the number of posts and then give the user the option to load more posts by clicking on a button. I’ve set this up as usual, using the load more interaction. But unfortunately, it is not working as expected.

While trying to solve the problem, I’ve tested the following things:

  • Removed the meta query in the template: the load more interaction works fine.
  • Added a meta query to a loop on a normal page using a specific ID like “1140”: the load more interaction also works fine.

So, I think the issue comes from using the {post_id} in a meta query in a post template.

Could you take a look at this issue? I can also send you login credentials if necessary.

Thank you very much and kind regards,

Hi Simone,
Thanks so much for your report!

Would you be so kind as to send temporary login credentials and a link to this thread to using the email address you used during the purchase?

This makes it a little easier to understand your setup and find the cause of the problem :slight_smile:

Best regards,

Sure. I’ll send you the credentials.
Thank you!

The quotation marks within the meta value are not necessary and ensure that the query does not work. Without them, it works perfectly, as far as I can see.

Ou! Thank you! I read somewhere that the quotation marks are needed. Sorry for not testing that.

The only thing I notice now, is that when I load more posts, they are not posts associated with the team. (womens teams on the men’s team page) Also some posts are shown twice.

Hey, you are using {post_id} as the meta value, which returns the ID of the post within the loop - not the id of the team post in which the loop is located and to which the ACF relationship refers. Instead, you should use {echo:get_queried_object_id()} as the meta value, which returns the post id of the actual team post.

However, there is a problem with the load more, as the meta value is always set to 0 in this case. I have added the problem to the bug tracker.

I have added a basic text element with the corresponding dd tags so that I can see what is happening, which you are welcome to delete.

1 Like

Hi Simone

as @timmse correctly pointed out, the quotation marks are only necessary in a loop to get the ACF bidirectional field data via the meta key matching.

In such a case, the quotation marks are necessary to ensure that the post ID matches exactly. For example “123” which prevents a match for “1234”.



1 Like

Aaah, I see. Thank you very much for the explanation and your help!

Hi Patric,
Thank you for the explanation. I should have read it more carefully. :see_no_evil:

Hi Stefan,
Thank you very much for resolving the issue in the newest update! :slight_smile:
I’ve just tested it, and it appears to be working well so far. The only issue I’ve noticed is that the button remains visible even when there are no additional posts to load.
Is there a way to hide the button with conditions?
Thank you very much for your work!
Kind regards,

Hi Simone,
can you send us access data (and a link to this thread) again? Unfortunately, the credentials from back then no longer work.

Please also tell us again where we can find the problem. Until then, I’ll mark the thread as resolved for now, as the original problem has been fixed.

Hi Stefan,
Sorry I’ve deleted the account too early. I’ve created new credentials and sent it to you.
Thank you for resolving the problem!
Kind regards,