Since you’re using WP_Query()
, you should consult the Codex entry for WP_QUery()
. It lists all of the parameters that can be passed to the arguments array.
In this case, you want to use the post custom meta parameters.
Assuming your custom meta key is _show_on_front
, and your value is true
or false
:
<?php
$custom_query_args = array(
'post_type' => 'Event',
'posts_per_page' => 1000
// INSERT POST CUSTOM META PARAMETERS HERE
'meta_key' => '_show_on_front',
'meta_value' => true
);
$custom_query = new WP_Query( $custom_query_args );
?>
For more complex examples, consult the linked Codex entry.
Related Posts:
- How can I sort homepage by a meta value?
- Limits, not all post are showen when querying for posts by view count
- searching by keywords in post’s metas or pagination links problem
- Custom post meta field effect on the performance on the post
- Difference between meta keys with _ and without _ [duplicate]
- Orderby meta_value only returns posts that have existing meta_key
- What is “meta_input” parameter in wp_insert_post() used for?
- How to enable revisions for post meta data?
- Meta Query with AND & OR?
- Can I count the number of users matching a value in a multiple value key?
- Is there a hook / action that is triggered when adding or removing a post thumbnail?
- passing argument to get_template_part() or a better way to code
- Create meta boxes that don’t show in custom fields
- Ordering posts by anniversary using only day and month
- How to break meta values into different items and avoid duplicates?
- ajax delete value from custom field array
- How to use pagination with get_post_meta
- Copying Custom Meta Values from existing post to a duplicate post
- Move value of one custom field to another
- Displaying posts with only upcoming dates according their custom field date value
- Custom fields: In what order are they saved into the DB?
- Get a post_id where meta_value equals something in a serialized meta_value field
- How to save a ToggleControl value in a meta field?
- How do I query for a post by custom field?
- How to display Meta Field Value?
- MySQL query to set wp_postmeta using term_taxonomy_id value
- How to Validate Post Meta type/extension (Video File Image File etc)
- Upcoming Event: How do I sort database by custom date field, but ignore past dates?
- Custom Meta Box not Saving in Posts with Gutenberg Editor
- How do I use wp_query for WordPress search?
- Nav Menu – Add class based on meta keys
- Conditional custom field query
- How to wrap meta values seperated by comma in ? [closed]
- Display only past events on that page using Visual Composer Grid Bulider
- Bulk remove post meta
- How to create html block to display extra information on woocommerce single product page
- Create Multiple File Upload Metabox in WordPress
- Run a check for multiple meta key values
- WordPress Rest API to call page data associate with custom meta
- Hide custom meta data if empty
- Add custom field to all posts in specific post_type
- Button inside Custom Meta Box triggering the Update Button
- How to load an assets based on custom field value?
- Why orderbyb meta_value_num won’t affect the generated SQL Query order?
- How can you include custom post meta in search without calling each key?
- Can I access a post meta field before the loop?
- wrap text around custom fields array
- How can I modify RSS item titles to be either the title or a custom meta field?
- Avoiding ACF get_field and returning to core WordPress function
- Get all the posts where meta field with multiple choice has several values checked
- wordpress custom loop ascending descending posts by custom field
- Move Title and the Content WYSIWYG editor position
- Hide custom fields when empty
- How do i get the attached images with custom value checked?
- How to query an out put value?
- Save all the post tags inside a custom field
- How add multiple wp_editor_box to new post
- Update post meta custom field using block editor
- Get custom fields without _edit_last, _edit_lock, _wp_page_template and _visual-subtitle
- Display posts with empty custom field
- Custom search SQL Query to add custom field in result
- Get YouTube video id from url in a custom field
- Related query shows same image in loop
- Why am I getting a “Call to member function format() on a non-object” error?
- Modify custom field from front end
- How to exclude custom fields from search queries?
- Footnotes in custom fields
- Create a new custom field for all posts based on current custom field
- wordpress get_post_meta / the_meta to output custom field value
- How to query posts by month based on date custom field?
- get_post_custom_values problem, please help
- update_post_meta not working well
- Problem with revisions only returning four results
- Search & column order by meta value in admin
- Custom meta fields and meta keys
- How to add a post’s view count into the WordPress API response
- Can’t set custom meta fields for a post
- Saving Custom Field that includes Quotation marks
- Post meta data not showing in frontend, until hitting ‘update’ button
- 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?
- update meta field value after
- Query Posts based on custom field value
- Echo out custom fields in comments
- Create custom query for search?
- Display Data From This Custom Media Upload Meta Box?
- Save values generated via API as custom meta fields
- Query postmeta values, and return multiple post_titles for common meta value
- When post is updated, custom metadata in text area field is overwritten
- Media Attachment Custom Meta Fields not saving in Media Uploader when using jQuery UI Autocomplete
- update_post_meta not working in action hook
- Custom Field: Display only if a specific key is selected outside the loop
- When editing a post with a custom meta box the values aren’t displaying correctly
- Hard Define Custom Field Value
- How to check if custom field exists in this widget query
- add_post_meta insert null value into Database
- How do i output images from URL’s added to the same custom field key
- Retrieving custom field as shortcode
- How to display search query as formatted text?
- save all acf options in one meta_value [closed]
- WP Query Args – search by meta_key or title