Use pre_get_posts
action hook
function archive_meta_query( $query ) {
if ( $query->is_archive){
$query->query_vars["meta_key"] = 'wolf';
$query->query_vars["meta_value"] = 'boltz';
}
}
add_action( 'pre_get_posts', 'archive_meta_query', 1 );
Related Posts:
- Custom query with orderby meta_value of custom field
- Query Posts or Get Posts by custom fields, possible?
- Add custom field to the archive page?
- query_posts and only show results if a custom field is not empty
- Archive sorting functions by custom fields (front-end)
- Order posts by custom field and if custom field is empty return remaining posts
- Query on custom field count?
- How to use query_posts() with a date filter on a custom field?
- meta_value_num sort glitch
- Can ordering post list by meta_value cause performance issue?
- Order by value in serialized custom field
- Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]
- How do I query for a post by custom field?
- meta query not showing any results?
- how can i use custom field in query post
- using multiple meta_key and meta_value in query_posts
- Query post order by post and desc not working
- How can I sort homepage by a meta value?
- Order query by meta_value with multiple custom fields
- Show 1 post and after a specific date show the next one
- How to select posts from multiple categories and metavalues?
- meta_compare seems to be treating values as strings instead of integers as expected
- Change order of posts
- Meta query with multiple custom fields for archives page ordering problem
- filter custom field values $min $max
- query posts custom field calculation value
- WP Query – Is this correct?
- Query_posts with custom field meta value
- Unable to get specific value from post meta
- Meta_query ‘compare’ => ‘LIKE’ not working?
- query_posts with meta_value
- Custom search SQL Query to add custom field in result
- How to put forward a blog post
- How can I change the publish date based on a custom field?
- Get author total post votes from post meta
- Problem with writting correctly a query posts args in WordPress
- simple fields plugin custom query
- query_posts -> get page_id from custom field
- WordPress archives by custom field and date
- Checking if field is set before comparing with meta_query in query_posts?
- Filtering posts by WORD in custom field
- Display agents (custom post type) alphabetically, except one who always shows last
- Filter Query Post by Custom Fields(by date)
- Archive for custom fields?
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Individual Widgets per Page
- How to add add_meta_box to specific Page Template?
- Apply the_content filter to a custom field with multiple values
- How to get users by a custom field / by user meta data?
- Auto sort the wp-admin post list by a meta key
- Adding another state (spam, reject, approve) to wordpress comments?
- Add field to posts (checkbox) that only one post can have
- Display custom field only if value present?
- Advice needed for importing custom field data and database structure
- How to save multiple metaboxes?
- Populate Custom Field Dropdown on Theme Install?
- Make URL in custom field hyper link
- meta_query for a string inside a meta field containing a comma-separated list
- Combine multiple custom field values into single value
- Creating a custom menu/widget area
- Fetch Record based on meta key dates
- Modifying custom order item meta from admin order view
- Let users track progress by entering a number daily in profile?
- WooCommerce – Adding Custom Fields To Invoice
- $form_fields from attachment_fields_to_edit returning empty array
- How to link keywords in custom fields?
- Customizing WP user profile with custom fields
- Adding custom field to post object from custom table
- Using abs() with custom field in orderby statement
- Can’t save custom field on registration page
- Is it preferable to use custom code to create metaboxes instead of plugins (such as ACF) and if so why? [closed]
- Function that replaces the image in the absence of the post meta
- check for duplicate user meta data before updating
- WP Cli – post add meta in xargs after wp post generate – add multiple fields
- Anyone know how to use ACF and show custom fields for logged in users only on a post? [closed]
- How to redirect to home page according to a specific page custom fields value and user name
- ACF Plugin How to make the customer add more fields in the post?
- custom field in admin columns
- Custom metabox not working
- Populate wordpress menu with link to custom field value (file download)
- Selectively hiding or allowing thumbnails of featured images on front page
- Users uploaded image and matching an id or taxonomy
- Adding data to User profile
- How can I change author of posts to the value of one of the custom field of the posts?
- Is it possible to add Term Meta Fields to a WooCommerce Attribute?
- Post meta data not showing in frontend, until hitting ‘update’ button
- register_form, custom field not submitted on first try
- How to properly get popular Posts by multiple Values
- Query Custom Fields in Searchform
- Make custom user_meta as permalink for post
- Creating Structured Documents (books) in WordPress?
- Filter query based on date in custom field
- Convert many posts from having a specific meta_key to use a post_format
- Custom fields: my custom checkbox area doesn’t seem to work
- get_post_custom_values not working
- Check if a field is capitalized?
- add multiple values (array) to post meta_input
- Assign class to Drop Down Selections in WooCommerce Products Custom Fields
- Multiple permalinks for a single post from custom field
- Search for meta_query does not return any result if combined with title