2 ms·
> I prefer to version sites with git and install updates locally, then git pull down on to the live server. I’m working on my first WP project and am trying th
by nsomaru 6y ago
> I prefer to version sites with git and install updates locally, then git pull down on to the live server.
I’m working on my first WP project and am trying this approach. A question I have is how do you handle plugins that have hooks that only run once when installed? Those hooks don’t run if you pull in via git. Also if they make changes to the dB (migrations), how is that managed if the plug-in was installed on a different server?
- ehnto 6y agoThat is all usually still triggered even when using git. Git doesn't manage the database, so when the files make it to production and the plugins are activated, they see a database they haven't been installed in and then correctly run their hooks. Same for migrations. Migrations are managed with database entries, so if your production database doesn't have those entries, it will still run the migrations. You can check out WP CLI to automate some of this as well.
- sleavey 6y agoAs far as I know there aren't any real hooks available for running code on plugin install, only activation. But I think OP is referring to core WordPress code and not plugins.