Timeline for Pagination only showed when no category is set in wp_query
Current License: CC BY-SA 4.0
24 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 8, 2023 at 1:32 | comment | added | james | Thanks so much for your help @SallyCJ! I'll give that a shot soon and let you know. | |
Mar 7, 2023 at 3:19 | comment | added | Sally CJ | But actually, if all the 5 tests were good on that new site, then there's likely something wrong (which unfortunately, I'm not sure what is it) on the other site you've been testing my plugin on. But if the test results were similar in both sites, then I guess it's time to contact your hosting support for assistance.. | |
Mar 7, 2023 at 3:14 | comment | added | Sally CJ | Tests 4 and 5 were good, so I suggest you to do a completely clean install of WordPress (no plugins and using a default theme like 2023, and with caching disabled) on a subdomain or domain on the same server (or under the same hosting account), and install & activate my plugin there, then create some (dummy) posts and publish them under a category named Videos. Visit my plugin admin page and then share a screenshot of the page. | |
Mar 7, 2023 at 1:45 | comment | added | james | Added the new screenshot of the plugin out. Thanks again! | |
Mar 7, 2023 at 1:44 | history | edited | james | CC BY-SA 4.0 |
remove plugin screenshot
|
Mar 7, 2023 at 1:33 | comment | added | Sally CJ | Thanks, but sorry, please just remove that screenshot and update your copy of my plugin, then capture another screenshot of the plugin admin page and add the screenshot to your post. After that, we should be able to identify the actual issue. (PS: I have deleted my gist and my previous comment 😅) | |
Mar 6, 2023 at 19:14 | comment | added | james | Added! And yes, 42 posts in the Videos category now (I added a few since my original post). | |
Mar 6, 2023 at 19:13 | history | edited | james | CC BY-SA 4.0 |
added mysql output
|
Mar 6, 2023 at 14:33 | comment | added | james | Uploaded another debugging summary! I also disabled WP Super Cache (and followed all deletion steps to remove any remaining files). I also made sure my host has caching turned off (unfortunately we are using Network Solutions for this site which has given me nothing but trouble). If nothing sticks out, I guess my next step would be to try to do a fresh install on another host to see what happens. | |
Mar 6, 2023 at 14:31 | history | edited | james | CC BY-SA 4.0 |
more debugging screenshots
|
Mar 6, 2023 at 3:43 | comment | added | Sally CJ |
Now it's getting more and more like a caching issue? Or something is filtering the found_posts value?? 🤔 Anyway, I've updated my plugin, so try that revised version and let's see what the other test cases (3 & 4) say. (PS: I've deleted my gist and created a repo instead)
|
|
Mar 5, 2023 at 17:27 | history | edited | james | CC BY-SA 4.0 |
added 73 characters in body
|
Mar 5, 2023 at 17:10 | history | edited | james | CC BY-SA 4.0 |
added request output
|
Mar 5, 2023 at 17:05 | comment | added | james |
I've uploaded the screenshot to the original post. I also uploaded another query I ran in the production database that gets the count of all posts within the Videos category just to make double check. The site has hundreds of posts in general (of post_type='post' ) so the output of the debugging from the plugin seems a bit off too. I'm not sure what is going on. Thanks for all of your help by the way, I really appreciate it!
|
|
Mar 5, 2023 at 17:03 | history | edited | james | CC BY-SA 4.0 |
adding screenshots
|
Mar 5, 2023 at 10:37 | comment | added | Sally CJ |
Actually, I just wanted to know/see the value of $my_query->found_posts , but apparently, WPSE cut the full dump output (and maybe you should just remove that from your post?), so try this: install this plugin and activate it, then visit the "WPSE 414370" admin page, and follow the instructions at the bottom of the page.
|
|
Mar 5, 2023 at 1:00 | comment | added | james |
Yeah the 5 was just testing. I verified I have more than 30 published posts within the Videos category. I added that var_dump at the bottom of my original post.
|
|
Mar 5, 2023 at 0:59 | history | edited | james | CC BY-SA 4.0 |
added query dump
|
Mar 4, 2023 at 19:53 | comment | added | Sally CJ |
Looking at the SQL, did you change the posts_per_page to 5 ? (in the question, it's 1 ) Anyway, are you certain the Videos category contains 30 or more than 5 published posts? If yes, then yes, that $my_query->max_num_pages value is wrong. Try var_dump( $my_query ); and add the entire output to your post/question.
|
|
Mar 4, 2023 at 19:07 | comment | added | james |
So it seems $my_query->max_num_pages is my problem then. Changing the total parameter in my paginate_links function to anything else makes the pagination show up. Are there any other debugging tips for figuring out why this wouldn't be set correctly?
|
|
Mar 4, 2023 at 16:39 | comment | added | james | Also for what it's worth, when I run that query in MySQL I receive back 5 post ids as expected. | |
Mar 4, 2023 at 16:31 | comment | added | james |
Thanks for the help! This is the output float(1) string(380) " SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (31) ) AND wp_posts.post_type = 'post' AND ((wp_posts.post_status = 'publish')) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 5 " . The output is the same whether I add the suppress_filters option or not.
|
|
Mar 4, 2023 at 3:23 | comment | added | Sally CJ |
Clear your caches, keep the 'category_name' => 'videos' in your args, then add var_dump( $my_query->max_num_pages, $my_query->request ); right below your new WP_Query call, and share what the dump says. Now add 'suppress_filters' => true to your args, reload the page, and see if the same issue persists - still no pagination showing?
|
|
Mar 4, 2023 at 1:02 | history | asked | james | CC BY-SA 4.0 |