WordPress#
Plugin Development (without WordPress core)#
When you open a standalone WordPress plugin in VS Code, the editor may report missing declarations from WordPress core.
Enable WordPress stubs: Open Command Palette (F1), run PHP: Workspace Stubs, search for "wordpress", and confirm with OK: 
Include additional libraries: If your plugin depends on other plugins, use one of these options:
- Add the dependent plugin folder to your VS Code workspace using
Add Folder to Workspace.... - Set the path to the dependent plugin using
"php.workspace.includePath".
Quick Setup Checklist#
- Enable the
wordpressstub package inPHP: Workspace Stubs. - Add dependent plugin folders to the workspace, or configure
"php.workspace.includePath". - Select the WordPress formatting style (see below).
Formatting#
Choose the pre-configured code style WordPress using the setting "php.format.codeStyle".

Editor Assistance#
WordPress Hooks Completion#
Available in v1.68 and newer.
The functions below provide hook-name suggestions from both built-in WordPress hooks and hooks discovered in your workspace:
add_filterapply_filtersapply_filters_ref_arrayhas_filterremove_filterremove_all_filtersdoing_filterdid_filteradd_actiondo_action_ref_arrayhas_actionremove_actionremove_all_actionsdoing_actiondid_actiondo_action

Hook names that contain placeholders (for example, add_{$meta_type}_metadata) are inserted as snippets with editable placeholder fields.
WordPress Hook Callback Completion#
When you add a filter or action, completion can suggest an anonymous function snippet:

WordPress Hook Parameters Inlay Hints#
With inlay hints enabled ("editor.inlayHints.enabled"), the editor adds parameter type information to callbacks based on the corresponding hook signature:

Related Links#
- Blog post: WordPress IntelliSense and Linting
- Code Styles: Formatting/Code Styles