Using different parameters for different queries with pre get posts in functions.php
Using different parameters for different queries with pre get posts in functions.php
Using different parameters for different queries with pre get posts in functions.php
The strtotime() function is what you need here: $date = date( ‘Y-m-d’, strtotime( $date ) ); //2015-04-10 with your example Note that you will need to do this when you save those values, not when running the query. You can’t convert data that’s already in the database on the fly when running a query. Edit: … Read more
New WP_Query calls Pre_get_posts filter twice
pre_get_post alter current post id
Have a look at WP_Query when you need to loop through posts. <?php $args = array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ‘post__not_in’ => array(), ‘order’ => ‘DESC’, ); $the_query = new WP_Query($args); // Show the first 3 posts while($the_query->have_posts()) { $the_query->the_post(); echo ‘<h2>’.get_the_title().'</h2>’; // Have we shown 3 yet? Break then. … Read more
Why does pre_get_posts() return “date” as the orderby parameter for every sortable column?
Your order seems arbitrary, so there is no clear way to express it as query parameters. The closest to micromanaging order is by post__in, but then you have to have all post IDs and it won’t be sane at all for any significant amount of posts. You might want to simply create and fill another … Read more
The problem was related with a WordPress update and the permalinks, I simply updated the permalink structure (without modifying it) and everything worked fine. I don’t know why, but if you’re facing the same problem or something similar is worth trying.
Change the main loop WordPress impact on the server?
Order ascending is ignored in meta query?