Skip to content

Instantly share code, notes, and snippets.

@kallookoo
Last active March 19, 2024 10:55
Show Gist options
  • Save kallookoo/e56db287c6c2ec53cbbf95da3230d7da to your computer and use it in GitHub Desktop.
Save kallookoo/e56db287c6c2ec53cbbf95da3230d7da to your computer and use it in GitHub Desktop.
Visual Studio Code Snippets for WordPress
{
"WordPress: Prevent Direct Access to files": {
"prefix": "wp-secure-file",
"body": [
"defined( 'ABSPATH' ) || exit;",
"$0"
]
},
"WordPress: Plugin Headers": {
"prefix": "wp-plugin-headers",
"body": [
"/**",
" * ${1:Plugin Name}",
" *",
" * @package ${2:PluginPackage}",
" * @author ${3:Your Name or Company Name}",
" * @copyright ${4:2024} ${3}",
" * @license ${5:GPL}",
" *",
" * @wordpress-plugin",
" * Plugin Name: ${1}",
" * Plugin URI: https://wordpress.org/plugins/${6:plugin-slug-name}",
" * Description: ${7:Description of the plugin.}",
" * Version: ${8:1.0.0}",
" * Requires at least: ${9:6.0}",
" * Requires PHP: ${10:7.0}",
" * Author: ${3}",
"${17: * Author URI: ${11:https://your-domain.com}",
"} * License: ${5}",
" * License URI: ${12:http://www.gnu.org/licenses/gpl.txt}",
"${18: * Text Domain: ${6}",
"}${19: * Domain Path: ${13:/languages}",
"}${20: * Network: true",
"}${21: * Update URI: ${15:https://your-domain-for-updates.com/my-plugin}",
"} */",
"",
"${22:namespace ${16:Your_NameSpace};",
"",
"}defined( 'ABSPATH' ) || exit;",
"$0"
],
"description": "Create the headers for main plugin file."
},
"WordPress: Plugin Header": {
"prefix": "wp-plugin-header",
"body": [
"/**",
" * ${1:Plugin Name}",
" *",
" * @package ${2:PluginPackage}",
" * @author ${3:Your Name or Company Name}",
" * @copyright ${4:2024} ${3}",
" * @license ${5:GPL}",
" */",
"",
"${7:namespace ${6:Your_NameSpace};",
"",
"}defined( 'ABSPATH' ) || exit;",
"$0"
],
"description": "Create the headers for plugin files."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment