Something like this should be the query you want to run, it adds a condition to the page query that requires the value in “meta_field” to equal the current category’s title.
global $wp_query;
$args = array('meta_query' => array(
array(
'key' => 'meta_field',
'value' => single_cat_title("", false),
'compare' => '='
)
)
);
query_posts(array_merge($wp_query->query, $args));
// The Loop Goes Here //
Related Posts:
- Upcoming Event: How do I sort database by custom date field, but ignore past dates?
- Loop through incrementing custom fields
- Compare ACF date field (if exists) and post date and order DESC
- How to rename a custom field?
- How can I make wp-pagenavi work on a custom query built upon a form submission? [closed]
- Meta Query with AND & OR?
- Order posts by custom field and if custom field is empty return remaining posts
- Calling Specific Pages with wp query Part II
- Loop through two different sets of custom fields
- Plugin similar to Taxonomy Drill-Down for custom fields?
- How do I query for a post by custom field?
- How do I exclude posts by custom field value?
- Echo values from custom field outside loop php
- Count how many posts have a custom field set
- Calling custom fields for pages (not posts)
- Duplicate posts being displayed when querying Custom Fields
- sort search results by custom fields using dropdown
- How can I sort homepage by a meta value?
- Conditional custom field query
- Display only past events on that page using Visual Composer Grid Bulider
- How can I show custom fields in the loop only to specific user roles?
- get_posts that match a user-specified value on a page
- Accessing loop functions (e.g the_title or the_content) from post ID
- Custom Field Create Bulk via SQL Query
- Create Pop-Up Box with Custom Field Content Inside the Loop
- query usermeta from custom field
- Is there any way to get all meta and standard columns for any WordPress object after searching based on meta key and value
- Limit the number of acf content when displaying in post loop [closed]
- Order RSS content by an advanced custom field value
- Order by empty custom field
- Is there a better way to list all database terms alphabetically?
- Alter main archive, to show posts with meta as last
- Change the main loop WordPress impact on the server?
- custom-meta-box checkboxes from loop won’t save
- How to show a post if was published less than two hours ago?
- List users by sum of all their posts’ custom field values
- Trying to reorder posts by custom field
- Limits, not all post are showen when querying for posts by view count
- Why orderbyb meta_value_num won’t affect the generated SQL Query order?
- Custom Fields – How to create a list from multi-line entries of a single value
- how to make nsfw post with thumbanil
- Custom Query based on custom field of a single post
- Get post ids sorted by meta_key
- Efficiently sort only certain categories by custom field
- querying a custom field
- Can I access a post meta field before the loop?
- Displaying page image in the footer automatically
- pre_get_posts : only get posts by wp_usermeta value
- Query post by date (stored custom field meta as yyyymmdd) and differentiate across 12 months
- Show image if author meta (profile fields) exists outside loop
- Can’t query by meta_key
- How to query an out put value?
- How to conditionally add Custom Post Type to Front Page
- List custom queried terms in the edit-tags.php?taxonomy page
- Modify date query by URL parameter using pre_get_posts and $_GET
- ul list with only as many li’s as filled custom fields
- Custom search SQL Query to add custom field in result
- do_shortcode close
- Search Results Page – Displaying Custom Meta Fields
- The best way to collision check in WP
- Interrogate a page within a loop to check template type or custom meta data (Pages vs Posts)
- Collect Data from NEXT item while in loop
- How to exclude custom fields from search queries?
- WP_Query () using taxonomy, custom post types
- How to query for posts with either one or another custom field
- Best way to sort estates and query them (for rent? yes/no. contains office space? yes/no)?
- How to show content of custom fields in search results?
- Custom Query: query by post custom meta data
- Custom field outside the loop and inside an array
- Get array of posts based on custom field values
- Display metabox title for custom fields with values
- use custom field value as post category in loop
- Searching with Multiple (Parallel) Criteria on Custom Fields?
- How to query posts by month based on date custom field?
- Filter or order based on custom field
- Custom Field Date Problem
- What am I missing in this Code Block?
- get_field values for each post on home page using wp_add_inline_style
- Problem with revisions only returning four results
- Search & column order by meta value in admin
- Dynamically populate query source in Elementor post widget
- Need to display a Jan 1st post as the site’s front page on Jan 1st, and Jan 2nd post as front page on Jan 2nd etc
- User Filter Options on Archive Page
- searching by keywords in post’s metas or pagination links problem
- Custom meta boxes – add php code inside?
- select user with all meta field and field value. I am use Below Query for this ,So any of know another way to fast query instead of below query?
- get wordpress post loop by meta box date
- Outputting custom field on home.php not outside of blog list
- Counting number of images from loop
- Metabox value for post loop?
- Get meta value when the page is a blog archive
- Create custom query for search?
- Loop through multiple custom fields with increasing number
- WP_query returns error when used for custom widget
- query specific posts according their custom fields, using sql SELECT
- Meta_query not filtering posts
- Get multiple posts with some custom fields efficient
- How to add a prefix to existing custom fields over MYSQL query?
- Complex WP_Query Using Post Date And Post Meta
- I want my post to republish again after adding a custom field