change your query a bit:
$todays_date = time();
$args = array ('post_type' => 'tasks',
'meta_key' => ''end_date,
'meta_compare' => '<',
'meta_value' => $todays_date,
'orderby' => 'meta_value'
);
$tasks = get_posts($args);
and then for each one of this posts get the start_date meta and compare with $today something like:
$today = strtotime($today);
foreach ($tasks as $task_post){
$start = strtotime(get_post_meta($task_post->ID, start_date, true));
if ($today > $start){
//to task stuff here
}
}
Hope this helps.
Related Posts:
- Get the ID of the latest post
- Number of posts in the archive
- Help ordering custom query by Title, Ascending
- How can I show a field ID in Elementor with Request Parameter
- Pagination not working with custom loop
- Getting the Intersection of Two Custom Taxonomy Terms for a Custom Post Type?
- Sort custom post type list table by display name of a user id stored as post meta value
- get attachments for all posts of particular post type
- List most recent image uploads, but only for specific custom post type
- Get all authors with at least one post of ‘custom post type’
- Custom Queries: Joining On Meta Values From Two Custom Post Types
- functions.php conditional tag only for custom post type
- Querying Posts by Taxonomy From Alternate Network Site
- Query posts between two dates (custom meta keys) CMB2
- How to get only one category of custom post type?
- Adding posts of custom type into the main feed
- Custom Select Query with Custom Post Types
- Get random custom posts from a custom post type
- WP_Query search posts by custom post type and custom taxonomy
- Calculating Bayesian average for custom post type
- How to filter custom taxonomy categories on archive?
- Modifying date filter on admin page for custom post type to link to custom field
- How to debug a blank page?
- query posts and custom post type with meta key
- WordPress Orderby Numeric Value Not Working
- Query string parameters from custom fields, inconsistent results
- Add post_type to index.php
- Order By Post Type ThenBy Taxonomy
- Custom query to filter posts that have current post as a taxonomy [closed]
- How inefficient is it to use a Custom Post for 4-5 sentences & pull all to 1 page?
- Custom post type redirected to homepage – how to debug
- How to modify archive query with pre_get_posts to append CPTs?
- convert custom query to wp_query
- Making certain categories of CPT not publicly queryable
- Get parse_query filter to return slug instead of id
- Querying both pages and posts
- Query Multiple Custom Posts by Custom Fields
- Specific query for custom post type
- Display post content with respect to its title?
- First custom field value (out of several) displayed twice after query
- Prioritize posts in query by meta keys?
- WP_Query orderby and tax_query
- Displaying Posts from Custom Post Types
- Different Ways to Query Custom Post Types?
- How to organise this data within WordPress
- Query custom post type based on post id and custom field value
- Make (custom) post type accessible only by custom query
- Graphql: Unable to query (where:{author}) for custom post type
- Return number of all custom posts type by author in all statuses
- Group by custom field value (start and end times)
- meta query not retrieving posts
- Hide text if query has no posts
- How do I get the index for a custom post?
- Getting custom post types to properly display alphabetically
- Filtering custom posts by custom fields (ACF) [closed]
- How to get custom post type title, excerpt, thumbnail and permalink by post ID?
- Get posts by category name
- Why the_excerpt() function returns excerpt on the Home page and trimmed content in sidebar?
- How to properly use Categories with Custom Post Types
- All in one calendar custom post type query doesnt work as expected
- Getting the list of the latests posts and custom type posts in the homepage
- How to divide Subcategories into pages of parent category wordpress
- Query filter by value in meta_value array
- Change search query in wordpress custom post type
- get_posts() returns empty on custom post type /wp-admin/edit.php
- WP Query: If field X is empty, show posts based on field Y
- Is there a way to use ‘publicly_queryable’ => false only on specific taxonomy term?
- Custom post type data not displaying If I select the category from the dropdonw
- Does this archive template part look like its making too many calls to the db?
- Shortcode with loop stacks output
- Displaying all posts by category and showing content on click
- Limiting the Number of User Posts to Their Own Posts
- Meta query and compare “!=” not working as expected
- How select query is generated in a Custom Post Type?
- Custom post type order by post_title
- How to hide sub fields in a field group and also the entire field group if the answer selected is “no”
- Query posts based on user preferences
- Linking posts together with Advanced Custom Fields “both ways”
- Error get_posts with Custom Taxonomy and OR relation
- Why get_posts() returns empty array while I am trying to get posts from some specific taxonomies and work properly with others?
- Show first posts with custom field not empty and order all by title
- Certain number of posts with certain excerpt length
- Is it possible to add query parameters on the archive page?
- Popup panel is only displaying 1 entry ignoring all others
- Query posts by a type and another type only if post is in specific category
- Query Only Show Text on Posts With Certain Taxonomy Tag
- Query child posts on parents single.php?
- Pagination not working with custom loop
- WordPress can only query up to 766
- shortcode for recent custom type post
- Pagination not working with custom loop
- Show custom posts with a specific “custom TAXONOMY slug” on startpage
- Allow admin to determine the order of queries?
- Posts 2 Posts: query connected — orderby problem
- Code in custom widget queries all posts, when it should only query the current post
- How to add post type in masonry posts elementory widget
- Display posts from another page on home page in wp-editor
- show custom post’s post in two different divs [duplicate]
- Get Posts ordered by a date custom meta field
- Add Category names to post lists of custom post type