this is not much of a question than a solution to a problem that i couldnt find.
Problem: On category archive made with custom query i could not get /page/2 to work ( always 404 ).
Tried every possible solution in the book, and finally i reverted back to the original query, there i wanted to change posts per page for this query to check if the problem is caused by my custom query. It appears that woocommerce changes posts per page with Apperance > Customize panel and dosn't use the Settings > Reading page. When you set there the number of items per row * number of rows to match your custom query demand all starts to work fine. Too bad that woocommerce had to make it so weird ( i kinda see the point why it is that way, just its very confusing) :D
Anyways i hope this helped someone, i wasted a healthy 2-3 hours on searching for solution. Cheers!
this is not much of a question than a solution to a problem that i couldnt find.
Problem: On category archive made with custom query i could not get /page/2 to work ( always 404 ).
Tried every possible solution in the book, and finally i reverted back to the original query, there i wanted to change posts per page for this query to check if the problem is caused by my custom query. It appears that woocommerce changes posts per page with Apperance > Customize panel and dosn't use the Settings > Reading page. When you set there the number of items per row * number of rows to match your custom query demand all starts to work fine. Too bad that woocommerce had to make it so weird ( i kinda see the point why it is that way, just its very confusing) :D
Anyways i hope this helped someone, i wasted a healthy 2-3 hours on searching for solution. Cheers!
Share Improve this question asked Jan 9, 2020 at 4:01 PatrykPatryk 12 bronze badges 3- Please write your solution as an answer, and then accept this answer. – fuxia ♦ Commented Jan 9, 2020 at 4:05
- Thanks for info, i posted my answer but cant mark it for 2 days from now :) Thanks for help – Patryk Commented Jan 9, 2020 at 4:19
- The problem is that you're using a custom query with pagination to begin with. If you want to change the posts that appear in an archive, you should modify the existing main query, not create a separate query in the template. – Jacob Peattie Commented Jan 9, 2020 at 5:48
1 Answer
Reset to default 0As stated in question, the solution to that problem is to set the woocommerce posts per page ( Apperance > Customize ) and your custom 'posts_per_page' to the same number. Hope it helps.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744848659a4596996.html
评论列表(0条)