Blank Pages after Page 1 Intermittently Happening On Damn You Autocorrect (8 posts)

  1. jillsays
    Posted 4 years ago #

    Hi all, I'm Jillian and I run a site called DamnYouAutocorrect.com.

    For the past few weeks, my readers have been complaining that pages after the main index page are intermittently not loading properly. When they click on to page 2, everything loads but the blog's main content - which displays a "page not found" error. But the header, sidebar, and footer are all fine.

    The issue randomly corrects itself later, but reoccurs randomly.

    I am running the latest version of wordpress and am using very few plugins: W3 total cache, GD Star Rating, and WP-Paginate.

    I'm also using a custom permalink structure: /%post_id%/%postname%/ ---and read somewhere that might be causing the problem. I tried implementing plugins and fixes for that, but people are still complaining it is happening.

    Others have suggested it might be ads causing the problem, but I'm hesitant to believe that since I'm running the exact same ads on other wordpress sites with no problems.

    This page issue has never happened to me so I can't even diagnose it. I've been trying for weeks to fix the problem but have been unable to, so any tips or ideas you all may have would really help me out.


  2. David Gard
    Posted 4 years ago #

    Firstly, I love that site, so hopefully it's fixed quickly, because it is a pain when it doesn't work!

    Secondly - suggestions! What trouble shooting have you done?

    My first though is the WP-Paginate plugin (I tried a few but finally settled on wp-page-numbers, seemed to be the only one that was not buggy).

    I would start by checking the query that is being run when the user goes to a different page. -

    echo $wp_query->request; - place at just before your loop.

    You can then copy the output in to PHPMyAdmin and that will tell you if there are any errors in the query - if there are, you can start narrowing down exactly what is causing them, but my money is on the LIMIT portion being incorrect due to WP-Paginate.

  3. jillsays
    Posted 4 years ago #

    Thanks for the response and the help Duckboy!

    First - I thought it might be WP-Paginate, but I switched to an entirely different plugin (WP-PageNavi) and it was still happening. So I just switched back to WP-Paginate.

    I really know very little about PHP and do not have a web designer (I run the site and network all by myself) so I'm sorry if I'm slow... but where exactly do I place the echo query?

    And where do the results of that query go?

  4. jillsays
    Posted 4 years ago #

    I just did a bit of research about incorrect limits, and stumbled upon this old comment here in the forums about WP-Paginate:

    Due to ceil being used instead of floor in the code, the pages are not being generated correctly.

    I tried making this switch in wp-paginate.php, maybe this will have an impact?

    Line 118:
    $pages = intval(ceil($wp_query->found_posts / $posts_per_page));

    should be
    $pages = intval(floor($wp_query->found_posts / $posts_per_page));

  5. David Gard
    Posted 4 years ago #

    Without knowing the code for WP-Paginate it's impossible to say if that is on the right track I'm afraid.

    For displaying the query -

    echo 'My Query: '.$wp_query->request;

    Place this code in 'single.php', just before your loop (Not sure of your setup, so either if(have_posts()) : while(have_posts()) : the_post();, or get_template_part('loop', 'single') - you will only have one of those).

    The output of the query will then be shown at the top of the page when a user visits the site, so if you do not have a development site you should move quickly. I'd put the code in, find a page that is not displaying posts, copy the query, and take the code out of the file pretty quick (so that users can't see the query). For comparison, it's probably a good idea to copy the query from a page that works as well, that way you will be able to see what is different about them.

    Once you have your query you can run it in MySQL and you will be told if you have an error in the code - if not, then the query is just being constructed incorrectly.

    If you require more help with the positioning of the code I suggested then please us a pastebin for your code from single.php and I will show you exactly where to add it.


  6. jillsays
    Posted 4 years ago #

    Duckboy, do you do this professionally? Could I hire you to look into this and fix this issue for me? If so please email me directly from the contact tab on my site.

  7. David Gard
    Posted 4 years ago #

    I use WP at work, so fairly familier with it. I will try and message you over the weekend and arrange a look at your source.


  8. David Gard
    Posted 4 years ago #

    Right, a little bust to go massivly in depth at the moment If you copy and paste your code for 'single.php' in to a pastebin and put the link to it on a post here, I will amend it with the code to show the SQL Query. If you could then post that query here (from a page that is blank) I'll have a look at it and see if I can see what is causing the Query to return no posts. Form there, I can make other suggestions.

Topic Closed

This topic has been closed to new replies.

About this Topic