See the codex re Meta Query.
For example, this would get all posts at least a day old:
$date = date('Y-m-d H:i:s',strtotime("-1 days")); // 1 day ago
meta_query' => array(
array(
'key' => 'name of your key',
'value' => $date,
'compare' => '<=',
'type' => 'DATETIME',
),
)
Related Posts:
- Query all posts where a meta key does not exist
- Exclude a category from WP_Query
- Single loop for wp_query and wp_user_query
- WP_Query orderby custom field then post_date in one query
- query multiple taxonomies
- Custom Post Type, WP_Query and ‘orderby’
- Include post id[s] into WP_Query()
- Syntax to get the Nth item in a list of custom post types?
- Grab 5 latest posts from custom post type ‘announcements’
- “pagination” (but not really) and queries using custom posts types
- Sorting a list of posts displayed under a list of associated terms (which should be sorted without initial articles)
- Query for posts from any post type but only add instock products
- Query not returning CPT posts
- Unable to display multiple post types in same query (WPML WP_Query)
- Pagination not working
- How to use custom post type APIs, but use a different db table
- Display all Posts and only certain Custom Post Types with meta fields
- Select menu should display categories and the item’s depth
- Custom Post Order for a Custom Post Type
- Why does using WP_Query inside a shortcode in an elementor page cause the arguments for WP_Query to get malformed?
- Lists Posts from CPT that match the Title of the Page
- Filtering by Post Meta Custom Fields – Performance
- Unable to get paginate_links working with a custom query [duplicate]
- Returning a list of custom post types excluding those without a specific meta_value
- query private custom post type
- Randomize Posts. Skip the first post in ascending order
- Pagination for Custom Taxonomy Page [duplicate]
- Custom loop with multiple taxonomy queries
- Isotope Filtering with Bootstrap Tabs – Custom Post Type Query Loop in each Tab (Have to click twice to filter)
- Custom taxonomy rewrite give pagination 404
- WP_Query order by custom field, then randomly order some of results
- creat filter with wp_query
- How to do WP_Query with two meta fields with orderby clause
- Get Posts by multiple custom fields is not working
- Custom query at top of archive search page, arguments are overridden
- How to have this permalink structure: post_type/postname/custom_inner_page
- Sort entries by date mixing two post types
- custom post type search by reference id
- Custom Taxonomy Not Showing in Front-End When Outputting a Custom Post Type with WP_Query()
- Print current post category during WP_Query
- Multiple Custom Post Type queries, how to DRY it up
- WPDB for post count on post
- post_per_page ignored in WP_Query
- WP_Query parameter conflict
- Retrieving meta-box from a custom-post-type
- Cannot get custom post
- Custom post type and standard post not displaying or working
- Display custom post type for specific user
- Get all post from a post type
- Trying to add a class to post links
- A faster way to query custom post types with multiple conditions?
- Custom Post Type Archive Pagination
- List all Custom Post Type posts excluding certain Taxnomy term
- WP_Query: Posts within category OR custom post type
- Custom post type pagination error
- WP query_posts group by meta field related
- posts_per_page in custom WP_Query does not override “Reading” settings?
- WP Query from two Custom Post type fields as statement
- Display Parent-Child Posts in specific order by comparing IDs in array
- custom post type and a “sticky” position taxonomy
- Display post count for a specific month
- Query to Exclude Child Pages from Custom Post Type Archive
- WP_query has incorrect wp_posts.post_name = ‘asc’ when I have custom post type called ‘order’
- Randomizing WordPress Custom Post Type Sorting Through Them Without Page Refresh
- Order posts alphabetically with numbers but some of the posts has numbers in the title
- How to output custom post type title on custom page with category next to it?
- How to sort by multiple values in a nested WP_Query
- SEARCH QUERIES – REVERSE OUTPUT
- post_type incorrect for custom post type
- Live search by custom tag
- Staggering featured post using ‘sticky’
- Ajax load more inside custom post type taxonomy
- How to get the posts that my following users are liked?
- Only show categories that have posts within custom post type
- Create a custom wp_query from a specific custom post type with specific taxonomy
- SQL LIKE in WP_Query
- How can you use a page for a custom post type?
- Display all Custom taxonomy terms and their relevant custom posts
- Query breaking with ‘posts_per_page’ => -1
- WP Query with multiple post types ordered by custom meta date then published date
- CPT Efficient way to display posts from different categories with custom query
- How To Loop Through list with Custom Post Types
- CPT or Custom Table for Repository of Serial Numbers
- Use Tags to Query Associated Multiple Posts and Get The Average Of Custom Field Values
- Custom Post Type + Category archive
- Values inside a custom field to determine which category posts to display
- WP_Query get posts where post_name is empty
- How do I sort post listing by child post count?
- Pop up showing same content on all posts display.
- Custom post-type’s pagination not working in category.php
- Querying meta values within an array
- Count of posts with meta_key filled in?
- Filter Custom post type by another Custom post type
- Archive page – problem with pagination
- Are custom posts included when getting a categories’ posts?
- Query order by meta value force specific tag first
- Quering array of post types & pagination. Articles are repeating sometimes on different pages
- How can I show posts with the same tag?
- Load posts via AJAX without draft status
- WP Query – Can’t get posts with specific taxonomy