Converting my old wordpress theme template to php 8.2 or above

Associate
Joined
29 Sep 2010
Posts
2,305
Location
Cumbria
I have used a template for years which I have hacked to bits to suit what I needed it for. When trying to upgrade to 8.2 it breaks to critical error. I have used it on multiple sites and I have to do them all.

I have been trying to find something similar to build from but they all seem the be designed for using poxy page builders, scss or both.

I have been trying to find somewhere online that may be able to convert the code used as a template for my current sites so that I can rebuild them all the same way. I only want the basic site done and the rest I will hand code again for any changes I need.

Can anyone think of somewhere where I could upload the files form my template to make them compliant from 7.4.

If not, can anyone recommend a simple template that is not reliant on scss or page builders. Needs to be woocommerce compatible too.

Thanks.
 
Last edited:
You could find out the cause of the errors with your current template.

Annoyingly the errors aren’t always written to the server error logs. So here’s what I do if I can access the server files.

Edit wp-config.php

Add the following “define” code snippets (making sure to temporarily comment out duplicates that might be in the config file):

define( 'WP_DEBUG', true );

define( 'WP_DEBUG_DISPLAY', true );

define( 'WP_DEBUG_LOG', true );

define( 'SCRIPT_DEBUG', true );

This will write errors to a log file, weirdly in the wp-content folder.

Make your changes (e.g. switch to PHP 8.2), try to access the site, then read the resulting log file.
 
Last edited:
You could find out the cause of the errors with your current template.

Annoyingly the errors aren’t always written to the server error logs. So here’s what I do if I can access the server files.

Edit wp-config.php

Add the following “define” code snippets (making sure to temporarily comment out duplicates that might be in the config file):

define( 'WP_DEBUG', true );

define( 'WP_DEBUG_DISPLAY', true );

define( 'WP_DEBUG_LOG', true );

define( 'SCRIPT_DEBUG', true );

This will write errors to a log file, weirdly in the wp-content folder.

Make your changes (e.g. switch to PHP 8.2), try to access the site, then read the resulting log file.
Thanks. Will have a look.

I messed about with chat gpt last night just to see and it said to upload the files and it would try and convert all files. It did and then I used the zip on a test website and I saw a couple of errors were scripts in function file I had added ages ago. Got rid of them to see and it actually worked. Nowhere near like usual, but its not not critical error. I am going to plough through it all on a test site and see what breaks it.

I will do as you suggested though to see if any of those errors are likely to exist in the 8.3 version from ChatGPT

I hate AI but it would be very handy if its broke the back of it for me.
 
Last edited:
It seems the AI changes doesn't like the back end. When adding or amending a post it updates but the screen goes blank, does not go back to the editor.
 
Is there anything in the browser console when you do that?

Perhaps revert to your original template (without the AI changes), enable the log debugging I mentioned earlier and check the log file for errors.
 
Hi @Frankiemac

Here is the checklist that I recommend you should perform:

1) Check the email sent by wordpress when the site started showing critical error. It might contain some valuable information about the error.
2) Deactivate all the plugins by renaming whole plugins folder inside wp-content or everything single plugin folder name. For eg: plugins_old or woocommerce_old.
3) Rename all the themes inside wp-content/themes.
4) Your site will be up by now with no content. If it still doesn't work, download latest wordpress from wordpress.org and install everything again.
5) Once your site is up, you need to test every plugin. I recommend renaming plugins_old folder back to plugins and see if site works or not. If not, rename all the plugin's folder name inside wp-content/plugins folders and start testing the site by renaming plugins to its original name one by one. If by activating a plugin, site goes down again- rename it back to something else, skip it and move to next plugin.
6) Keep performing these steps and you will definetly find the culprit.

If site is working after activating all plugins, then perform similar steps with theme and files inside themes.

While performing steps, keep a close look on the debug.log file and the error that wordpress outputs on the frontend after enabling WP_DEBUG in wp-config.php (method shared by Nabinium above).

Let me know, how it goes.
 
Back
Top Bottom