please I need help resolving a pagination problem with wordpress. I currently using WP 3 RC1.
The problem is that I get a 404 error when I go to page 2 of my archive after setting the posts_per_page to a value different from that set on admin settings page (lower value than that of settings).
This is what I understood:
If I set the value of posts_per_page variable on query_posts to a lower value than that set on the settings page than I will get the 404 error.
Example: settings set to 10 posts per page [$ppp = get_option('posts_per_page') will echo 10]
posts_per_page set to 3 on query_posts
If I have a total of 9 posts on my wordpress database then, with the settings above, page two will not show and I get the 404 error!
This is because - I THINK but I may be wrong - wordpress still consider the 10 posts per page setting to determine IF the second page exists or not, completely ingnoring that I set posts_per_page to 3 on the query_posts and so even if there should be a total of 9/3 = 3 pages he calculates 9/10 = 1 page and so page 2 does not exists.
This could be an explanation but what is the solution?
I already read the codex pages and searched the forum and googled the internet but find only people with the same problem but no solution.
The code I wrote is correct infact if I set the global setting of posts per page (from admin page) to the same value of that set on the archive page (via query_posts) [so that posts_per_page = get_option('posts_per_page') = 3 for example) then everything works fine! And all the 3 pages works without problem (no 404 error).
Please help me find a solution for this. I already wasted much time!
PS Don't just say it is because of WP 3 RC1: I had the same problem also on 2.9.2