WordPress code completion and navigation
To take advantage of coding assistance provided by PhpStorm, the WordPress installation you are working with must be configured in the project as an external library. This way, the WordPress core files will be involved in indexing, which is the basis for resolving references and providing code completion, navigation, search, and other PhpStorm's coding-assistance features.
Hooks support
PhpStorm indexes all hooks declared in the WordPress core and in the included plugins. This makes the basis for coding assistance when working with hooks.
Hook names completion
Hook names are available in code completion of standard parameters for action and filter functions add_action()
and add_filter()
.
Start typing the declaration of an
add_action()
oradd_filter()
function.Press Ctrl+Space and choose the relevant parameter from the list.
Navigate between hook registrations and invocations
You can navigate from a hook registration (add_action()
or add_filter()
functions) to the hook invocation (functions like do_action()
or apply_filters()
).
Go from hook registration to hook invocation
Click in the gutter area next to the hook registration.
PhpStorm opens the file where the hook is invoked and places the caret at the invocation method, in the current example it is
do_action
.If there are several hook invocations, PhpStorm prompts you to choose the relevant one from the popup.
Go from hook invocation to hook registration
Click in the gutter area next to the hook invocation function.
PhpStorm opens the file where the hook is registered and places the caret at the registration method.
If there are several hook registrations, PhpStorm prompts you to choose the relevant one from the popup.
Go to callback function from a hook registration
You can navigate to the declaration or usages of the callback function that is specified as the second parameter of a hook registration (add_action()
or add_filter()
function).
To go to the callback function declaration:
With the Ctrl key pressed, hover over the relevant parameter. PhpStorm displays a popup information message with the definition of the function or method specified as this parameter:
The parameter turns into a link. When you click this link, PhpStorm opens the file where the function or method was declared and places the caret at thedeclaration.
To go to the callback function usages:
Place the caret at the relevant parameter and press Alt+F7 or choose Find tool window opens with a new tab showing all the detected occurrences of the function.
from the main menu. The
Viewing the official WordPress documentation from PhpStorm
You can view the official WordPress Documentation at http://wordpress.org/ right from the PhpStorm editor.
Select the text you are interested in.
From the context menu of the selection, choose Search on WordPress.org.
PhpStorm opens the page with the relevant documentation in the default browser.