• After I upgraded to 4.2.2 today, I noticed my (somewhat neglected) blog’s main page was just a single post from 2007.

    I’ve written about a thousand posts since then–they’re all still on the weblog in the Posts section, but I can’t get the main page to show new posts, just that single post from 2007. I checked the Reading preferences to make sure I was set up for my newest posts to show up on the main page and this was set correctly.

    Here’s what I’ve tried so far:

    – switching to a different, unmodified theme (several of the default themes that come with a WordPress install–twenty fifteen, twenty fourteen)

    – re-installing a new version of 4.2.2, both from the weblog and by FTPing in a new version of everything but the wp-content folder

    – switching the main page to a static page, then back again

    – clearing caches

    – turning off all plugins

    – using WP-DBManager to repair the database

    – restoring a backup using UpDraft (I haven’t visited the weblog in a few months, so it’s possible that all of the backups exhibit this problem)

    Any ideas? My heavy coding and database work are pretty far in the past, so at this point I’ve run out of things to check. I’m not sure what could have gone awry to make WordPress pull up a single post as the main page.

Viewing 8 replies - 16 through 23 (of 23 total)
  • Here’s the code I mentioned

    add_filter( 'redirect_canonical', 'dont_mess_my_homepage', 10, 2 );
    
    function dont_mess_my_homepage( $redirect_url, $requested_url = null ) {
    
    	if ( $requested_url === null ) {
    
    		return $redirect_url;
    	}
    	if ( $requested_url == 'https://www.johndan.com/workspace/' ) {
    		return false;
    	}
    	return $redirect_url;
    }

    I tried to replicate your bug on my server, and the only way I was able to do that was, selecting a static page, then go to DB, and change the value of the option “page_on_front” to a post id(not a page id), and I got the exact output in the redirect debug log as yours.

    Thread Starter johndan

    (@johndan)

    Thanks. What file should I insert this code into?

    – Johndan

    Either the theme’s functions.php or if there’s some custom plugin you have on your site, you can insert the code in that as well.

    Thread Starter johndan

    (@johndan)

    OK. I’ll work on this tomorrow and see if it solves the issue. Thanks again for all of your assistance.

    Always welcome ??

    Thread Starter johndan

    (@johndan)

    I’m not sure if this is progress, but I plugged the code you gave me into the functions.php file for the theme I’m running. That gave me a 404 error when I tried to load the site.

    – Johndan

    johndan

    That was what I was afraid might happen, but if it did, then it only proves that in your wp_options table(assuming you have wp_ as prefix) you have the option “page_on_front” set as that post’s ID, remove that manually in DB, and see if it works(worked on my test installation)

    Thread Starter johndan

    (@johndan)

    I think there’s some other issue involved. The value listed for page_on_front in my database was set to 0.

Viewing 8 replies - 16 through 23 (of 23 total)
  • The topic ‘Main Page Loading (Single) Old Post’ is closed to new replies.