Developing plugins for WordPress can be a real hell if we do not provide ourselves with the right tools.
Writing plugins “from scratch” in a text editor is feasible for small developments but, as its extension and complexity increases, the need for a proper IDE becomes evident.
Fortunately, we can configure PhpStorm, one of the best IDEs available for PHP, to comfortably develop plugins in Wordpress.
Suppose we have installed our version of JetBrains PhpStorm, and a test installation of Wordpress on XAMPP or on another similar server.
To begin we create a new project. We define the project’s address, its name, and choose “Wordpress Plugin” as the project type.
In the next screen, we choose the location of the Wordpress installation (for example, C:\xampp\htdocs\wordpress)
With this, we have created the project, but it is still necessary to configure the Wordpress installation as external libraries. To do this, we double click on “External libraries”
In the next window, we press the “add” button and add the network location of our test Wordpress.
Finally, we go to “File/Settings” and verify that the “Wordpress Integration” option is correctly configured.
If we are going to work on an existing project, without going through the project creation Wizard, we must configure the integration from this last window.
We check that everything works correctly, testing the suggestions and autocompletion of words. For example, if we write “add_action”, PhpStorm suggests the available commands. We can move between options with the up and down keys, and accept one with the tab key.
If we now write, within “add_action(’ ’)”, the word “footer”, and press control+space, PhpStorm suggests the possible Wordpress hooks.
With this, we have PhpStorm configured to program plugins for Wordpress in a comfortable and fast environment, which will delight the most demanding developers and the most complex projects.