I just tested this with ‘posts_per_page’ => 10 and it worked like it should.
@domy thank you very much. I added your tips and my script works well too.
But I’m wondering that the same script(I mean without “posts_per_page” parameter) works correctly in my local environment, all posts will be loaded. But when I upload it to my server, there are only 5 be loaded….
Thats very strange. Could you please double check, that you have really uploaded the correct file?
By default the WordPress list 10 posts per page.
This settings can be changed on Settings Page -> Reading
http://codex.ww.wp.xz.cn/Settings_Reading_Screen
I believe in your local it’s 10 posts on Admin and in your server version is 5.
If your Admin still 10 posts as Reading by default, check all plugins you have or your theme.
Every settings can be replaced using a Plugin or by functions.php as they are saved on wp_options table.
Check the posts_per_page option: http://codex.ww.wp.xz.cn/Function_Reference/get_option
get_option('posts_per_page');
If is 5, check where is using register_settings() or update_option()
http://codex.ww.wp.xz.cn/Function_Reference/register_setting
http://codex.ww.wp.xz.cn/Function_Reference/update_option
@leo Caseiro
Thank you so much Leo.
I checked the setting on server as your guide and it’s true the display posts number option was set to “5”.
Also thanks for your relative articles. I’ll come to read them to avoid “stupid” issue:)