I’m having some difficulty understanding syntax to make a call from my application to the wordpress REST API when it it comes to getting pages that contain multiple tags.

I have no problem with doing a call like

 https://example.com/cms/wp-json/pages?filter[tag]=L1

but I am unsure of how to call the API if I want to filter on posts that contain the tag L1 AND L2 AND L3, etc….

1
1

I ran into the same problem but for posts. I found how to OR or AND tags together here:
https://codex.wordpress.org/Class_Reference/WP_Query#Tag_Parameters

To get entries that have both L1 AND L2 AND L3 ; use plus (+)

https://example.com/cms/wp-json/pages?filter[tag]=L1+L2+L3

In case somebody else comes along and wants to OR terms together I’ll save you the trouble: To get entries that have either L1 OR L2 OR L3 ; use comma (,)

https://example.com/cms/wp-json/pages?filter[tag]=L1,L2,L3

I have only used this with posts but it should work for pages too.

Leave a Reply

Your email address will not be published. Required fields are marked *