php - WP Query, latest posts doesnt show
Get the solution ↓↓↓Im experiencing something a bit weird - I have a custom query that should display the latest posts from all categories, however, it doesn't :(
<?php
$args = array(
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => 'post',
'posts_per_page' => '5'
);
$customQuery = new WP_Query( $args );
?>
However, if i manually define which category id's it should display from, it works? Why? And should it work fine without me having to define the category id's manually?
<?php
$args = array(
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => 'post',
'posts_per_page' => '5',
'cat' => array(1, 2, 189, 520) //It works if I add id's from all categories
);
$customQuery = new WP_Query( $args );
?>
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: an exception occurred in the driver: could not find driver
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.