-2

I know that you can install plugin code as part of a theme, but I would like to do it the other way round. I'm developing a plugin that does a lot of non-public things, but I would also like to bundle a theme with it.

It seems from this question that it's possible to use the plugin's activation function to copy the theme files to the necessary place and then activate it using switch_theme, but there are enough aspects of this method where something can go wrong (e.g. permission issues when copying the theme files) that I feel this is something better handled by WordPress core.

Ideally, I hope there is a way that I can provide the theme files as part of my plugin, so that I only have to manage one project, and the user only has to update one plugin.

  • 1
    I'd advise against this, if you can't bundle both in the same zip, and the plugin is on .org, then putting the theme on .org and prompting the user it's recommended within your UI would be better – Tom J Nowell Mar 6 '18 at 19:23
0

It looks like the function register_theme_directory can be used for this purpose.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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