Visual Studio Code by Microsoft is the new kid in the block and it is gaining popularity everyday. Today we will explore free WordPress Visual Studio Code extensions. Visual Studio Code is a source code editor developed by Microsoft for Windows, Linux and macOS. It includes support for debugging, embedded Git control, syntax highlighting, intelligent code completion, snippets, and code refactoring. It is also customizable, so users can change the editor’s theme, keyboard shortcuts, and preferences. It is free and open-source, although the official download is under a proprietary license
It lists out all the components of Gutenberg so that you don’t have to search and look out for components and then importing them in their right parent component. All the official handbook components are included in the snippet.
Installs: 3.5+ Reviews: 0 Average Ratings: n/a Last Updated: 24/12/18 Publisher:Asphalt Themes Supported WP version: 5.0+
Auto completes WordPress snippets for Visual Studio Code. A very handy extension when you code in WordPress way. Although this doesn’t cover every snippet of WordPress sometimes makes WordPress coding easier. Some of the auto complete snippets are –
Comment form template
Comment template
Plugin base singleton
Plugin readme
Post template
Register nav menu
Register sidebar
Sidebar template
The loop
Widget template
WP query
Installs: 143K+ Reviews: 13 Average Ratings: 4.5 Last Updated: 13/8/18 Publisher: tungvn Supported WP version: 4.6.1
This extension adds various snippets for WordPress development. Helpful for auto completing different snippets, you can type part of a snippet and the extension will auto complete for you. Type
of snippets, you will get autocomplete for –
1. Dashboard Snippets
wp_change_admin_footer_text // Change Dashboard footer text
wp_disable_visual_editor // Disable Visual Editor
wp_change_admin_logo // Change Admin Logo
wp_column_thumbnail_to_post_list // Add thumbnail column to post listing
wp_remove_admin_bar // Remove Admin Bar
wp_remove_dashboard_css // Remove Dashboard Css
wp_remove_dashboard_widget // Remove dashboard widget
2. Meta Tag Snippets
wp_meta_open_graph // Add open graph meta tag
3. Shortcode Snippets
wp_shortcode_member_content // Only Member can view the content
3. Widget Snippets
wp_widget_disable_page //Disbale widget from custom page
wp_widget_disable_page_and_role //Disable Widget from Specific page by user role
4. WordPress Core Snippets
ADMIN_COOKIE_PATH // Core ADMIN COOKIE PATH constant
add_blog_option // Add a new option for a given blog id.
add_action // Core Hooks a function on to a specific action.
This one the best of WordPress Visual Studio Code extensions. It covers more than 3000 snippets and for having snippets for every WordPress function, class and constant – complete with argument type hints and brief descriptions right in your inline editing experience. Just start typing the function, constant or class name, and the extension will provide an auto-complete list of matching entities.
Features:
Snippets for every WordPress function, class and constant, with argument type hints and brief descriptions
Spend less time checking documentation with argument type hints
Easy function completion with tab stops in all the right places
WordPress API Support: 4.9.4
3,005 Functions
401 Classes
516 Constants
Usage
Just start typing the function, constant or class name, and the extension will provide an auto-complete list of matching entities. Once you’ve selected the correct entity, press Enter to trigger the
snippet. Use the Tab key to move through each function argument, where applicable.
Requirements
These snippets are bound to the PHP language context. Your cursor will need to be inside a set of <?php ?> tags.
Installs: 210K+ Reviews: 5 Average Ratings: 5.0 Last Updated: 26/8/21 Publisher: wordpresstoolbox.io Supported WP version: 5.8
Sometimes, a block of code will be flagged by WPCS with an error which you wish to ignore. An example of this could be a variable which is sanitized or escaped elsewhere before being used or
output. WPCS lets you white-list given errors for a line or block of code.
Available flags for whitelists
Escaping / XSS
WPCS 2013-06-11 +
// WPCS: XSS ok.
Sanitization
WPCS 0.4.0+
// WPCS: sanitization ok.
Nonce verification / CSRF
WPCS 0.5.0+
// WPCS: CSRF ok.
Loose comparison
WPCS 0.4.0+
// WPCS: loose comparison ok.
Overriding WordPress globals
WPCS 0.3.0+
// WPCS: override ok.
Unprepared SQL
WPCS 0.8.0+
// WPCS: unprepared SQL ok.
Tip: before whitelisting a query, if you are passing user-supplied data through $wpdb->prepare()as part of the $query parameter, even if that data is properly escaped, you also need to check that it is does not make the query vulnerable to sprintf()-related SQLi attacks.
Use of superglobal
WPCS 0.3.0+
// WPCS: input var ok.
Direct database query*
WPCS 0.3.0+
// WPCS: db call ok.
Database query without caching*
WPCS 0.3.0+
// WPCS: cache ok.
Slow (taxonomy) queries
WPCS 0.12.0+
// WPCS: slow query ok.
This flag was originally called tax_query and introduced in WPCS 0.10.0. The tax_query whitelist flag has been deprecated as of WPCS 0.12.0 and is superseded by the slow query flag.
Non-prefixed function/class/variable/constant in the global namespace
WPCS 0.12.0+
// WPCS: prefix ok.
WordPress spelling
WPCS 0.12.0+
// WPCS: spelling ok.
Precision alignment
WPCS 0.14.0+
// WPCS: precision alignment ok.
PreparedSQL placeholders vs replacements
WPCS 0.14.0+
// WPCS: PreparedSQLPlaceholders replacement count ok.
Installs: 30K+ Reviews: 2 Average Ratings: 5.0 Last Updated: 24/7/19 Publisher: Claudio Sances WP version: n/a
If you develop mostly in WooCommerce and write related snippets daily then you’re in luck this is a perfect match WordPress Visual Studio extension for you. This extension for Visual Studio
Code adds WooCommerce snippets and auto complete of functions, classes and hooks.
Installs: 45K+ Reviews: 4 Average Ratings: 4.5 Last Updated: 22/1/19 Publisher: Claudio Sanches WP version: n/a
ACF dedicated snippets for WordPress Visual Studio Code users. This extension has lot of options to make your ACF coding easier in Visual Studio Code. All tab triggers follow the following
naming convention; field:{field type}:{type/option}. All fields also have appropriate tabstops setup, however the first will always be the field name. Some of the snippets are –
Basic Fields
field / field:header / field:text / field:link / field:option(HTML/PHP)
Get a field by name. (Header / text / link fields will be wrapped in <h*> / <p> / <a> tags)
PHP Code Beautifier and Fixer for Visual Studio Code This extension provides the PHP Code Beautifier and Fixer (phpcbf) command for Visual Studio Code. phpcbf is the lesser known sibling of phpcs (PHP_CodeSniffer). phpcbf will try to fix and beautify your code according to a coding standard.
Preview
right mouse-click, in context menu, select ‘Format Document’. Here using the WordPress-Core standard. You can also enable formatting on save.
Additional standards
If you add a standard to phpcs, it will be available for phpcbf. Some popular standards are: Drupal, WordPress, Yii2, Magento and Symfony
Installs: 35K+ Reviews: 5 Average Ratings: 3.4 Last Updated: 1/10/18 Publisher:Per Soderlind
This is a collection of VSCode Text snippets for the Advanced Custom Fields WordPress plugin. Might come handy for ACF heavy users. Snippets are categorized into –
Standard Field Snippets
Sub Field Snippets
Options Page Field Snippets
Repeater Field Snippets
Flexible Field Snippets
Gallery Field Snippets
Google Map Field Snippets
Utility Snippets
Installs: 3k+ Reviews: 2 Average Ratings: 5 out of 5 Last Updated: 20/2/2019 Publisher:Shaun Baer
This project is aimed at helping folks using Genesis to work faster and more efficiently. This project was forked from Jason’s VSCode WordPress Toolbox. These snippets are bound to the PHP language context. Your cursor will need to be inside a set of PHP tags.
Installs: 3.5k+ Reviews: 0 Average Ratings: n/a Last Updated: 31/3/18 Publisher:Craig Waton
This visual studio code extension for WordPress replace your manual work for adding localization. It wraps a string and then you can do a search/replace for ‘text-domain’. Extension can also wrap with string concatenation.
Installs: 1.5k+ Reviews: 0 Average Ratings: n/a Last Updated: 21/9/18 Publisher: Cambam
Search WordPress Docs is a VS Code extension that allows you to select text inside the VS Code editor and search the WordPress Codex/Code Reference sites for a matching function, class, method, or hook. The extension takes your selected text and opens google’s first result that matches.
Installs: 19k+ Reviews: 2 Average Ratings: 5 Last Updated: 23/06/19 Publisher: Yogensia
Even though WordPress visual studio code extensions are fewer in number but we hope that over time they will increase in numbers. Did we miss any VS Code extensions? Do you you have any special recommendation for any particular extension? Let us know in the comments!