The Content of custom template pages print twice

I have two custom page templates that have been working properly for over a month, but now when I view those pages, their contents get shown twice on the page, one right after another.

For example: Here, here, and here.

I’ve triple checked my two page templates and there are not multiple instances of the_content.

I recently updated to WP 4.5 and updated all plugins as well as made some changes to the styles. I don’t know how any of these would affect things, but I did try disabling all plugins and the problem persists. I don’t see the issue happening locally, only on the staging server.

What the heck could be happening here?

Hey, do you have a GitHub repo of the theme for reference?

Hi! I have a private bitbucket I can invite you to if you’d like to message me your email address.

I got the invitation and I created a local site running WordPress 4.5 and your theme (using some demo content).

And the problem does not appear in my local copy, so I have to think it’s one of your plugins. Have you tried disabling plugins one by one to see if the problem goes away?

Are you using a page builder like Visual Composer, or a shortcode plugin?

It might be worth setting up Trellis (or VVV, or MAMP, or whatever) to test upgrades before deploying them live. Trellis makes this super easy by keeping the whole Vagrant (local virtual machine) config right in your Git repo, but it’s not the only option.

With a local VM environment running your site, you can test upgrades, and also test the disabling of plugins without affecting your live site.

Anyway, it’s almost definitely one of your plugins causing the problem.

2 Likes

Hey, I really appreciate you going to all that effort to check it out.

I disabled all the plugins again but it’s still happening. This is SO weird. I kind of don’t know what else it could be. I mean, if it was the 4.5 upgrade then it should be happening locally.

I do have MAMP set up for my local install. It’s not quite mirrored to what’s on the server though (it’s behind, since we’ve been adding content/plugins to the staging site). I haven’t used Trellis but I will check it out with my next project, thanks for the suggestion.

If any other ideas pop into your head let me know.

Any caching plugins installed? If you copy the database to your local machine does the problem follow it?

After hours of troubleshooting this I have tried:

Restoring database and WP files back to 4.4.2
Optimizing the restored db
Removing old leftover tables in the db and plugin folder that are no longer in use
Deactivate/Reactivate all plugins multiple times and testing

I cannot reproduce the issue locally. I copied over the live db and files and the pages work normally, which tells me it’s probably not the theme or a plugin.

I had a hunch maybe the wp_posts table was corrupted… but then the restore should have fixed that?

My next step will be to remove all non-WP files from the server to see if somehow something is interfering with WordPress (there is an instance of Code Ignitor running). Beyond that, I haven’t a clue…

Just wanted to follow up and say that this issue is now resolved. I still don’t really know what caused it, or how exactly I even fixed it (!). The problem went away when I re-uploaded two template files. So my only guess is that when I had uploaded those files a few days ago, something went wrong in FTP and they never completed. So the page wasn’t seeing the right thing and maybe the loop wasn’t closed.

The site is now live and all is well. Thanks for the help Michael!

1 Like