I don’t understand why can’t you use the post_date
of the custom post type
which includes date and time together?
$arg = array(
'post_type' => 'custom_post_type',
'orderby' => 'post_date',
'order' => 'DESC')
$result = get_posts($args);
Related Posts:
- How to get order of posts?
- Order posts by ID in the given order
- How to order posts tag by tag?
- Show all parents and children in custom post type in right order
- WP_Query Order by Specific Post ID First
- Order by empty custom field
- How to order posts by title after they have already been sorted by category
- WP Query – order posts by meta field first and then order the rest
- Filtering by multiple conditions in the loop
- WP_Query orderby random do not repeat infinite scroll – one loop
- How to order posts, that have already been filtered by custom taxonomy, by their category names?
- Display three sequential posts on each page load, without repeating previous
- Can I force WP_Query to return no results?
- Ignoring initial articles (like ‘a’, ‘an’ or ‘the’) when sorting queries?
- Multiple WP_Query loops with Pagination
- Sorting: custom query with orderby meta_value_num THEN by title
- WP_Query and next_posts_link
- Too slow when using both ‘tax_query’ and ‘meta_query’ both in WP_Query
- Get array of posts from the current archive page loop
- How can I save an array from a random post sequence for later use?
- How to place a loop within another loop?
- In loop: posts have thumbnail AND other variables
- WP_Query sort by comment meta data
- How to order category.php loop by ‘meta_value’?
- Pagination/infinite scroll with WP_Query and multiple loops
- Order posts by tags count?
- Orderby = none not working [duplicate]
- Add inline HTML to posts published within last 24hrs
- Move posts to top of WP_Query if in certain Taxonomy?
- WP_query ‘orderby=none’ Problem
- Display different number of posts from one category on the different pages
- Pagination not working Search posts
- Can certain (site-crashing) limitations on WP_Query in shortcode be overcome?
- Ordering by meta_value AND date NOT WORKING with wp_query
- WP_Query orderby breaks when using AJAX?
- Change default ordering of taxonomy terms – pre_get_terms
- Implementing an OR statement to wordpress wp_query
- Get List of all the Authors
- Undefined WP_Query::has_posts()?
- WP_Query loop within WP_Query loop
- Refine search results using WP_Query
- How to pass many ids in post__in?
- How to show subcategories using loop?
- Sub-loop / nested loops Best Practices
- (Solved) WP_Query ($ args) -> How to sort letters and numbers within the same array
- Show Sticky Post at the top but do not show again in the loop?
- Any number in meta key (wp query)
- How to get all unique categories for posts in loop?
- How do I run through a WordPress loop called from a filter function?
- How do I get the title of a category in a custom loop?
- WP_Query: Group events by year, sorted DESC; then by date for each year group, sorted ASC
- Order by summing multiple values
- Understanding the orderby in WP_Query?
- Out Of memory issue on post per page parameter
- Check if loop has any categories?
- WordPress query with items from more than one selfdefined taxonomy as `term` argument
- Get all fields inlcuding “ACF” (Advanced Custom Fields) columns in wp_query
- Change query from cat id to slug or name?
- Using Wp_Query without the loop?
- Custom WP_Query id
- Assign custom parameter to each post in query
- How to use WP_Query() on single.php?
- Loop increase in while loop not working
- How does WP generate the default $query in WP_Query based on the URL?
- how to get category`s slug in WP_Query loop?
- How to remove only the latest sticky post from the loop
- How I can repeat 2 HTML templates in a WordPress Query?
- Function using get_posts() with tax_query not working when called from functions.php
- Offset WP_Query by negative 1
- Advise on Templates for Custom Queries
- Query WP Page for Buddypress Group Home [closed]
- $post in wp_query?
- How to pass the current content of $wp_query to a new page?
- How to separate two columns from one content on a page template?
- How can I order a post query’s results based on the number of matching taxonomy terms?
- Custom WP Query order function possible?
- Can I alter the main loop to ‘orderby’ a custom callback?
- WooCommerce | AJAX | Product Pagination | Help me implement Ajax Pagination
- Meta query orderby meta_value_num sorting by role first
- Avoid removing duplicate posts
- WP Query with meta queries
- Regarding a custom loop and output HTML tags
- Repeat array inside array through while loop
- What’s causing an infinite loop?
- pages shortcode filtering by category
- Second WP_Query loop shows data from main query
- Meta Query if Values Don’t Exist
- Get post Number with local loop and template
- display post multiple times based on array of dates
- Problems with WP_Query, Loop, a condition and Posts per Page
- WP_Query secondary query failing
- Custom search (wp query by custom fields)
- Sorting is not working in WordPress WP_Query
- Add custom WP_Query after the first 3 posts
- Limit the number of posts from a specific category on index.php
- Posts2Posts, wp_query and orderby issue
- Change posts archive ordering
- Carousel Loop only duplicating
- How to show featured post first, then separate loop for other posts
- Query All Posts: Either Display Most Recent or One with Particular ACF Value Chosen