PhpStorm 2016.2 Help

Preparing to Use WordPress

On this page:

Overview

PhpStorm provides a dedicated interface for developing and running WordPress applications and provides WordPress-aware coding assistance, see WordPress Specific Coding Assistance. To get access to this functionality in a project, you need to download WordPress, register it in PhpStorm, and activated the WordPress integration within the current project.

Alternatively, you can download WordPress and create a stub of a WordPress-targeted project. In this case, the WordPress integration in the project will be activated automatically.

Whether you enable the WordPress integration in an existing project or create a stub of a WordPress application, PhpStorm checks if the development environment is configured properly for WordPress development. If the configuration does not meet the requirements, PhpStorm displays a pop-up window with a Fix link.

Before you start

  1. Make sure the PHP interpreter is configured in PhpStorm on the PHP page, as described in Enabling PHP Support.
  2. Make sure the PHP and WordPress Support plugins are installed and enabled. The plugins are bundled with PhpStorm and activated by default. If the plugins are not activated, enable them on the Plugins page of the Settings / Preferences Dialog as described in Enabling and Disabling Plugins.
  3. Configure the PHP interpreter to use WordPress with, as described Configuring Remote PHP Interpreters. Note that WordPress requires PHP 5.3 or higher.

Downloading and installing WordPress

  1. Download the WordPress.zip archive at https://wordpress.org/download/.
  2. Extract the archive:
    • To have the possibility to run your WordPress application on a local Web server, store the extracted file to the document root of the server where the PHP interpreter is configured. For local development environment with the Apache HTTPD Web server, extract WordPress.zip to the htdocs folder.
    • To run your WordPress application on an in-place server, store the extracted file under the project root.
    • To run your WordPress application on a remote server, store the extracted files in your project and then configure automatic upload of them to the document root of the remote server.

      Learn more about server access configurations, see Configuring Synchronization with a Web Server. For information on configuring upload to the server, see Uploading and Downloading Files.

    • If you are not going to run your WordPress application but just need to get coding assistance from PhpStorm, store the extracted files anywhere on your computer. In this case, you will have to configure the installation as an include path, see Configuring Include Paths.

To run WordPress in the command line mode, you will need a set of command line tools which you can acquire by installing the wp-cli/wp-cli package using the Composer dependency manager or by downloading the wp-cli.phar archive. For details, see Using the WordPress Command Line Tool WP-CLI .

Activating the WordPress installation in a project

  1. Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing File | Settings for Windows and Linux or PhpStorm | Preferences for OS X, and click WordPress under Tools.
  2. On the WordPress page that opens, select the Enable WordPress Integration check box.
  3. In the WordPress Installation Path text box, specify the folder where WordPress is installed. This folder should contain the wp-admin and wp-includes subdirectories.
  4. Click Apply to save the WordPress registration and click PHP.
  5. On the PHP page that opens, add the path to the WordPress installation folder to the Include Paths list: click the add button and specify the path to the installation folder in the dialog box that opens. Learn more in Configuring Include Paths.

Generating a WordPress application stub

During project creation, PhpStorm can generate a project stub for developing WordPress applications. The project structure is set up in accordance with the WordPress requirements.

  1. Choose File | New Project on the main menu or click the New Project button on the Welcome screen. The New Project Dialog dialog box opens.
  2. In the left-hand pane, choose WordPress Plugin.
  3. In the right-hand pane, specify the folder where the project will be created. In the WordPress Installation Path text box, specify the folder where WordPress is installed. This folder should contain the wp-admin and wp-includes subdirectories. Click Create to start the project stub generation.
  4. If the newly created project is outside the WordPress installation folder, configure it as an external library by adding it to the list of included path.
    1. Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing File | Settings for Windows and Linux or PhpStorm | Preferences for OS X, and click PHP under Languages&Frameworks.
    2. On the PHP page that opens, add the path to the WordPress installation folder to the Include Paths list: click the add button and specify the path to the installation folder in the dialog box that opens. Learn more in Configuring Include Paths.

See Also

Last modified: 2 September 2016