Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 285 Vote(s) - 3.49 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WP_Query() does not return all entries

#1
I have this query that returns only a few of the entries I have on the table. I have over 10 posts but this query only returns 6. Please help with suggestions



$query = new WP_Query("year=2011&monthnum=09&post_status=publish&post_type=post&orderby=post_date&order=DESC");
while ($query->have_posts()):
$query->the_post();
$title=get_the_Title();
echo"<p><input type=\"checkbox\" name=\"MyArticle[]\" value=\"".get_the_ID()."\">".get_the_Title()."</p>";
endwhile;
wp_reset_query();

Reply

#2
Try adding `posts_per_page=-1` to the string of parameters passed to `WP_Query`.

If that value is not set, then it falls back to use the default posts per page option you have set in `Settings >> Reading >> Blog pages show at most`.

My guess is that this value is 6 so its returning that many posts since you did not specify a different limit.
Reply

#3
$args = array(
'post_type' => 'product',
'orderby' => 'ASC',
'posts_per_page'=>-1
);
$wp_query = new WP_Query($args);
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through