Programmatic Activation Of Theme Not Working
-
Hi,
I want to activate a theme programmatically that I have uploaded via ftp.
Method 1: If I ‘activate’ the new theme as suggested in many posts simply by changing the ‘current_theme’, ‘template’ and ‘stylesheet’ options of the wp-options table using mysql the new theme becomes the active theme however posts are not being displayed.
Method 2: If I activate the theme manually from within the admin area the posts do display. Checking the wp-options table after this manual activation shows that tens of new entries specific to the new theme have also been added to the wp-options table.
Therefore method 1 is clearly inadequate as it doesnt trigger the initialisation/configuration of the theme proper. I need to achieve the result of manual activation as in method 2 but programatically.
Please bear in mind I need to do this for many websites and so the solution needs to be scripted to automate. Any solution is acceptable and doesnt need to worry about being upgrade proof etc.
I have taken a look at the switch_theme hook and a few solutions based on it but none of them work for me and simply result in the same as method 1. I am unsure as to how and where best to insert or modify core or theme code to achieve manual activation.
The solution should run in linux as either bash, php, mysql, wp api calls or a hybrid – whatever is needed. Once I have a single working solution I can create the scripts for all other domains easily.
Please respond if you have the slightest input – I am pulling my hair out trying to get this working.
Many thanks,
big_s
- The topic ‘Programmatic Activation Of Theme Not Working’ is closed to new replies.