WordPress Core Snippets for Visual Studio Code

The ultimate WordPress developer companion for Visual Studio Code with snippets for:

  • 3,062 functions
  • 385 classes
  • 516 constants

Extension Features

  • Easy function completion with argument type hints, tab stops and automatic text selections in all the right places.
  • Emmet-style abbreviations for all WordPress core functions. For example, type gtp for the get_template_part function.

Download & Install

Download and install this extension on the Visual Studio Code Marketplace.

Usage

Important: These snippets are bound to the PHP language context in Visual Studio Code. This means that your cursor will need to be inside a set of PHP tags in order to be triggered.

  1. Start typing the WordPress function, constant or class name that you want to use, and the extension will provide an auto-complete list of matching entities. You can also use Emmet-style abbreviations. For example, type gtp for the get_template_part function snippet.
  2. Once you’ve selected the correct entity, press Enter to trigger the snippet.
  3. Use the Tab key to move through each function argument, where applicable. The extension provides a type hint for each argument and automatically selects each argument block for ultra-fast function completion.

Configuration & Options

The extension itself doesn't require any configuration. However, if you'd like to trigger these snippets from within other snippets (for example, say you want to autocomplete get_the_ID( ) as the first function parameter of get_the_terms( )) you'll need to uncheck the Snippets Prevent Quick Suggestions setting in Visual Studio Code.

This setting can be found in Editor > Suggest: Snippets Prevent Quick Suggestions.

Troubleshooting

  • If the snippets are not triggering, ensure that your cursor is between a set of PHP script tags.

Support

Need help? Reach me on Twitter: @j_pomer

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.