0

So, I have this issue, where this happened two times. There is two pages - blog (which is based in index.php) and Thank you page (page-thanks.php).

In some conditions, these two are blank and in "admin bar" (black one on top of the page) is showing just "Blog" title and can't edit the page.

On the page, there is just header and footer (it's loading correctly). But where should be content, nothing is loading.

Query Monitor is showing in "Template" hooks just "home.php" and "index.php" as final load file.

First time, I switched off WP Rocket and it started working. The second time, I activated twentytwenty theme and then reactivated my theme.

And in both cases, it stared working as it should. But there is no log of any kind about error, warning or anything. I can't reproduce it anywhere and it happened only on PROD server - not on localhost.

I have no idea, what to do or how to investigate that.

PS: I am developing sites for years and this is first time, I see something like that.

1
  • Are you using the same version of PHP in both environments? Sounds to me like there's a difference between the local and the production environments. It'd also be helpful to see some code, maybe just minimal versions of the template files.
    – markcbain
    Commented Jan 2, 2020 at 18:02

1 Answer 1

1

I think, it's because of DNS problem. The old site URL is likely the public DNS name for your EC2 instance when you installed WordPress. If you are not sure of your old site URL, you can use curl to find it with the following command.

curl localhost | grep wp-content

You should see references to your old public DNS name in the output, which will look like this (old site URL in red):

<script type='text/javascript' src='http://ec2-52-8-139-223.us-west-1.compute.amazonaws.com/wp-content/themes/twentyfifteen/js/functions.js?ver=20150330'></script>

Download the wp-cli with the following command.

curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

Search and replace the old site URL in your WordPress installation with the following command. Substitute the old and new site URLs for your EC2 instance and the path to your WordPress installation (usually /var/www/html or /var/www/html/blog).

php wp-cli.phar search-replace 'old_site_url' 'new_site_url' --path=/path/to/wordpress/installation --skip-columns=guid

In a web browser, enter the new site URL of your WordPress blog to verify that the site is working properly again.

let me know if that works!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.