This isn’t possible via WP_Query
, but more importantly, this would be stupendously expensive. Taxonomy queries are expensive. Post meta queries are super super expensive. Like queries are also expensive.
Finding all posts that have a term that has a meta that is like X, is an astoundingly expensive/slow query. Writing this out as a custom SQL query is the only option, and I would be surprised if the query finished in under 10 seconds. It could easily bring down a database server if your site gets a moderate or higher level of concurrent traffic.
Would it not be orders of magnitude faster and simpler to have a city taxonomy? If you need to filter or search for posts by something, use taxonomy terms. Meta is not for searching
Related Posts:
- get_the_terms error
- Exclude posts which have any term in a certain taxonomy from the query
- Get terms in hierarchical taxonomy
- Tax Query trouble
- Exclude taxonomy term from list of current taxonomy terms
- Query Two Different Taxonomies Nested
- I need posts within a taxonomy category that are tagged “featured” to show up first
- Get taxonomy url, name, post count & image
- How to show amount of post in a taxonomy with advanced custom fields?
- Hiding an Advanced Custom Field based on Taxonomy Field selection
- Can One Taxonomies Terms be Ordered by A Seperate Taxonomy?
- How to get taxonomy term of the current page and populate queries in the template
- Custom taxonomy list page?
- tax_query in get_posts() not working?
- What is wp_insert_term “alias_of” arg for?
- wp_set_object_terms() — prevent overwrite?
- List Hierarchical Term List with Count with Related Term
- Is there a way to set singular/plural labels for taxonomy term names?
- List taxonomy terms as links
- Get_term_by only returns one item from array
- Can we have same term slug in different taxonomies?
- How to have “the most used tags” taxonomy always expanded?
- Get parent and first child taxonomy terms?
- Get wordpress taxonomy archive and sort by year
- Search for tags
- What hooks/filters are there to alter selected terms on post save?
- Filter blog archive by category in URL
- tax_query: What to pass when I want to have all terms?
- Custom Roll/Custom Post Type – Can’t Select Categories
- Trying to list terms of a custom taxonomy using get_categories
- Add a term to an attachment submitted from front end
- Get and loop posts with all taxonomy terms
- Unable to delete a Category and Tag that share same slug
- what tables uses wp_get_post_terms
- List a current posts’ taxonomy terms in a widget in WordPress
- Should I be using custom post types for this or terms and taxonomies?
- How can i list the categories of a post type, the taxonomy
- Set post terms on post publish
- How to display terms from a custom taxonomy in a hierarchy AND with custom html markup?
- How can I find the taxonomy in edited_{taxonomy}?
- extend HierarchicalTermSelector function with custom renderTerms
- Searching in wordpress using wp_term_taxonomy table
- How to get the top level parent term Advanced Custom Field values in the child terms
- Allow a Taxonomy Term to be Used Only Once Across All Posts
- Enable users to change change and add taxonomies of posts
- Pulling Data from CSV vs. pulling data from database
- “AND” relation in custom taxonomies
- Problem with Query on Taxonomy
- List posts in a category grouped by other categories?
- is_taxonomy() is not working
- Add text to the end of each list item in wp_list_categories
- get_term_by seems to be failing
- A function to add arguments to a taxonomy
- How to return newly added terms when using wp_set_object_terms
- How to update a taxonomy term for a custom post type with auto incrementing number
- Filtering elements by taxonomy slug
- Echo taxonomy name – second level
- Custom Post Type + Custom Taxonomy = Archive Listing Page Problems
- Taxonomy term archive default loop returns 1 record instead of 8
- Query custom taxonomy for category including children
- Taxonomy Checkbox Admin Panel
- Related terms – Terms that feature in post of current term
- Replacing a placeholder term with a session variable value in taxonomy filter
- Loop problem – Taxonomy
- How to relate to 2 taxonomy with category
- WP Search using taxonomy terms
- Is possible hide hierarchical select dropdown created by jetsmartfilters? (only visual issue)
- Prioritise Pages over Taxonomy Term Root Archive, but not Taxonomy Term Child Archives
- How do I converge taxonomy category permalinks into one?
- Add terms to a taxonomy archive from within the same taxonomy
- Taxonomy terms are not checked when edit custom post
- Url leading to archive page, no matter what
- Fill New Taxonomies
- Checking if a product ID has taxonomy term attached not working with has_term
- Can I create a tax query to return posts that match two slugs from same taxonomy
- Taxonomy.php inheriting first post
- Display related terms from a taxonomy in an entry
- I want to get term by term_name without taxonomy
- Search for single post by 2 tags
- Add specific content to a taxonomy results page
- Set the limit of taxonomy per page
- What is this Query? and why its taking too much time? Any way to optimize it?
- taxonomy terms, inverted
- How to share terms between two taxonomies?
- Taxonomy Rewrite Problem
- Taxonomy terms can’t find posts from archive.php or taxonomy.php
- how to print post tags [duplicate]
- Filtering posts by taxonomy and meta_value
- How to get a query odered by N of matching taxonomies?
- GET Taxonomy ID
- Non-Recursive get_term_children()
- Multiple loops on a Search result page?
- How do I add tags/taxonomy to images + a query field on page to query ‘albums’ (images with same tag/taxonomy)
- Delete Term via edit-tags.php
- Description of a sub-taxonomy
- Order taxonomy terms by the frequency of use in the last 30 days
- I need to add new menu item inside the custom post admin menu
- Add URL field to wordpress taxonomy
- Display taxonomy terms when adding a link in the admin
- Bulk import in custom taxonomy