It should be this:
WP_Query Order By Parameters
<?php
$rp = new WP_Query(array(
'post_type' => array( 'post','videos','projects' ),
'orderby' => 'date',
'order' => 'DESC',
'posts_per_page' => 4
));
while ($rp->have_posts()) : $rp->the_post();
?>
Related Posts:
- Meta_query compare operator explanation
- Exclude a category if post is only in that category using wp_Query
- Too slow when using both ‘tax_query’ and ‘meta_query’ both in WP_Query
- Use of caller_ get_ posts
- Tax_query terms ID’s using variable
- Custom query incorrectly returning everything [closed]
- Last post ordered by publish date using WP_Query on front page
- Query certain amount of posts from multiple dates
- Meta Query with date and time on the same Day before given time
- Order posts by tags count?
- Orderby = none not working [duplicate]
- Add inline HTML to posts published within last 24hrs
- Querying Multiple Custom Taxonomy Terms
- Single page theme
- Unable to combine “search value” and “tax_query” using WP_Query
- How to extend tag and category “Related Posts” query to custom post_type if the first 2 terms have no posts
- WP_Query search for whole words
- WordPress pagination link always leads to home page
- Query posts with more than 20 comments
- WP_QUERY returns empty set when fired from a WP-CRON scheduled event
- Including only current user’s posts in search
- WP_Query, tax_query and term_meta: How to?
- How do I reset this wp_list_categories query?
- Refine search results using WP_Query
- query_posts: how to show all ‘meta_value’ containing a specific word?
- How to pass many ids in post__in?
- How to show subcategories using loop?
- Query with a meta value inside a given range
- Pagination of a WP_Query Loop in a child-page page template
- Add condition of user capability in WP_query
- add_filter() depending on search term
- Get all products which have both product category
- How do I run through a WordPress loop called from a filter function?
- Fastest way of counting posts of a custom post type in a specific taxonomy term?
- WP_Query: Group events by year, sorted DESC; then by date for each year group, sorted ASC
- How to display user order by role
- WP_Query | Tax_Query Relation | Unable to use ‘OR’ as it then allows all products, help me finish my query?
- Why is wp_query causing an uncaught error to is_user_logged_in() not defined?
- Modify wp-query and sort by post meta key
- Orderby listing issue
- Check if loop has any categories?
- WordPress query with items from more than one selfdefined taxonomy as `term` argument
- Multiple filter conditions for WP_Query
- Get all fields inlcuding “ACF” (Advanced Custom Fields) columns in wp_query
- get_post_meta in WP_Query
- How to alter local query, not main query [duplicate]
- How to pass orderby params to $wpdb->prepare()?
- Get author if post has multiple authors
- Hide posts with meta key in WP_Query
- What happens to the default query when I use WP_Query?
- Modifing archive query affects show post count function
- For what queries is conditional tags informative?
- posts archive page – closing WP_Query loop correctly [closed]
- JSON – Create rest api endpoint for Advanced Custom Fields
- Query_vars support in Rest API
- Is it possible (and how to) query single Gutenberg blocks?
- Continue or break the while loop
- Get meta_value of a specific meta_key from all posts belonging to a specific custom type
- Custom query filter by ACF date custom field
- Nested array issue in meta_query
- Query by key or author
- Why doesn’t my WP Meta Query return any results?
- How to build the WP_Query using the code?
- How go give $value to wp_query
- Show multiple tax_query from 2 or more post_type in a single code
- Disable (or limit) queries when certain content (or data) is not needed (or showed)
- How to make the ‘request’ filter work?
- How to use rewind_comments() – when and how to use it?
- How to make a query returning pages from multiple parents
- create a custom query for posts managed by Restrict Content Pro
- How do I stop the same post showing multiple times in a archive?
- Related categories order posts by category
- Finding post ID dynamically on click
- paginate_links method doesn’t show second page of my custom wp_query
- Wp_Query Post per page not working?
- Order Element By Custom Field in WordPress
- Display All Top Child Categories / Taxonomy
- how to get custom attachment url?
- ACF Post Object meta-query by title not ID
- Case insensitive ORDERBY in wpquery
- Sorting with meta_query and multiple, optional meta keys
- getting posts by tags
- WP_Query & Duplicate entries
- Query child posts with tax query on parents
- How to break up output of posts for different terms on same page?
- Get posts by similar names and categories
- Calculating efficiently on large amount of data generated by wp_query
- Include post_status check within $wpdb query
- Return on a quest all these meta_value
- Complicated WP_Query
- Filter WP_Query output before it is accessed (pre_get_posts)?
- Divide WP_Query posts by date & post type
- Custom query to show posts
- New WordPress WP Query using posts from certain categories
- Taxonomy related query not working
- Multiple Orderby is not working right
- WP query based on two meta queries
- WordPress website links redirect to homepage
- Query All Posts: Either Display Most Recent or One with Particular ACF Value Chosen
- Can I use WP_Query to find a post with a particular menu_order?