How to Meta Query for Page X

Hi, since my last succesfull meta query it has been quite a while.

If I am not totally wrong the selected posts and pages will be compared to certain values set in the meta query… :thinking:

To start out small by filtering for a page X:

I have the following pages:

  • Doctors
  • Locations
  • Cwicly
  • Home

I am using the page home to display the query. The setup is in the image below.

The heading is set to the dynamic value of the Wordpress post title.

grafik

And the query outputs the expected pages cleanly.

grafik

I know that I could filter the pages by using the include/exclude post section, but this is a meta query test.

grafik

So, what should I do to simply filter for the page name?

I tried something like this:

Meta query name

Not sure if the reason that only home is displayed because I am on the page home but well… lets go to the next test.

Now let’s try to select a meta key? I tried here to filter for an post ID. the page home has the ID 10.

Meta query by ID

Not sure what I am missing…

But well in the next test I try to filter for a relation with ACF.

Here the ACF field which is placed in the ACF group Webdesign Settings

The group is located on the page home and has REST API set to on.

grafik

On the page home I selected the pages Home and Cwicly.

And now trying to meta query for that relation.

Meta query by ACF relation

So, these are only three of the examples I tested from the 100+ today. I must do something fundamentally wrong here to not achieve any results.

I would really appreciate pointers here and would like to see a solution to at least for the ACF relation.

Hi @T-low,

I think there’s a little misunderstanding here.

When have the post ID or title been a meta key/value? :see_no_evil:
Also, dynamically calling the Post ID as a Meta Key will literally ask WordPress to look for a Meta Key equal to 10.
Is this what you want? Do you have a Meta Key that equals 10 on your pages?

As for the last query, It seems as if the field type (which should be set to string) is not applying to ACF values, which should be fixed in the next update.

I confirm :wink:

To Query one specific post in the Query Editor
Go to Posts / Include Posts and search for the title of the post you are looking for in the search box.
That’s it!

For the ACF relationship

It is similar
Go to Posts
Include Posts
Dynamic:
ACF
your acf field group
the relationship field

You might not see the results on the back-end ( I have this issue) but it should work on the front-end (at least it works for me)

Best,

J

1 Like

Thank you @Louis for the reply.

Best remark :+1:

It seems that I oversimplified my problem there and was just tossing random values into the fields :grimacing: Doing that way too often until I realize as you mentioned that I selected dynamic data.

But it seems that I do not know what meta key/values are :thinking:

Post IDs are no meta values?
At least everything that is created with ACF are meta values? right? :crazy_face:

_
Thank you for the reply and the help @JuGa. I know that I can include/exclude posts. :wink: Next time I will put that remark higher to the top :yum: