WordPress Self-defined Plugin

Composer

PHP composer has a native support for wordpress plugin:

"package": {
    ...
   "type":"wordpress-plugin"
   ...
}

This will automatically install the composer package within wordpress plugin folder.

Plugins structure

Instead of generating multiple plugins for the wordpress, we can implement multiple extensions within one single plugin. The strucutre will look like:

Plugin
  |----woocommence extension
  |----thrid party auth
  |----analysis
  |---- ...

We can also implement a page to manage the plugin and turn on/off the extension.

Improve the performance

We can use plugin for caching the wordpress website. The cache can be used in front end, db and anywhere else.

Tips:

  • It’s not a good practice to change the function within the theme.php because it may affect the user access. Besides, once we change the theme it may cause issues. So we should use plugins instead of theme.
  • Security. We can hide and change the api url for admin and other security module.

Leave a Reply

Your email address will not be published. Required fields are marked *