elevati / wp-api-multiple-posttype

wordpress wp rest api v2 extension of wp/v2/posts api to allow query multiple post types
GNU General Public License v3.0
48 stars 7 forks source link

Thought as composer mu-plugin #13

Open MaximeCulea opened 6 years ago

MaximeCulea commented 6 years ago

Hi there !

Thx you for this awesome work. I wanted to implement it myself, then I saw your plugin.

One thought, I will require it as composer mu-plugin and not plugin. As it could break routes and then content requesting.

With mu-loader, it's very smooth ;)

salil-elevati commented 6 years ago

Hello Maxime,

I am not aware of mu-plugins. Can you share some mu-plugins. I can refer them and understand the changes required to have it as a mu-plugin.

Thanks, Salil

MaximeCulea commented 6 years ago

Hello @salil-elevati,

So I would have load this plugin as Must Use Plugin rather than a traditionnal plugin.

The main reason is that plugin can be deactivated. So if the WordPress is running a web add, etc, the wanted contents available through created routes could not be anymore reachable. So a simple action could break so much !

To avoid this, loaded as mu-plugin with a mu-loader, this plugin would be always activated, no matters what happens.

What do you think about it ?

salil-elevati commented 6 years ago

Hello @MaximeCulea I installed mu-loader, and see we do not need any changes to the plugin code to work as Must Use Plugin.

So, do I need to change in the plugin composer.json to install in mu-plugins directory?

MaximeCulea commented 6 years ago

Hello @salil-elevati,

I would simply change wordpress-plugin by wordpress-muplugin into https://github.com/elevati/wp-api-multiple-posttype/blob/master/composer.json#L3. And add the mu-loader trick into the installation notice.

Best,