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 changes many aspects of WordPress and most will not be visible without my theme providing support for it. In other words it makes very little sense to run the plugin without the theme. I understand that it's not encouraged/allowed to do this in plugins hosted on wordpress.org, but my plugin is not distributed there and requires an administrator to upload a zip (which I take to mean they will have read the readme that explains the side effects).
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.