Created
May 17, 2017 14:32
-
-
Save rob-gordon/eafb6ae8c7cd5428298c186263db1890 to your computer and use it in GitHub Desktop.
Confusing WP Query's with ACF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Querying a relationship field (stored as a serialized array) | |
| # https://www.advancedcustomfields.com/resources/querying-relationship-fields/ | |
| $related_posts = get_posts([ | |
| 'post_type' => ['publication'], | |
| 'posts_per_page' => 6, | |
| 'meta_query' => [ | |
| [ | |
| 'key' => 'related_research_area', | |
| 'value' => $cur_id, | |
| 'compare' => 'LIKE' | |
| ] | |
| ] | |
| ]); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment