WordPress TutorialRemove Version from WordPress and StylesheetsRun WordPress local with XAMPPSecurity in WordPress - EscapingSecurity in WordPress - SanitizationThe Loop (main WordPress loop)Update WordPress ManuallyWordPress Actions and FiltersWordPress add action()WordPress add editor style()WordPress add menu page()WordPress Add ShortcodeWordPress add submenu page()WordPress add theme support()WordPress Add/remove contact info for users with user contactmethods filter hookWordPress Admin Dashboard WidgetsWordPress AJAXWordPress Alternating main loop (pre get posts filter)WordPress Child Theme BasicsWordPress Create a Post ProgrammaticallyWordPress Create Template for Custom Post TypeWordPress Creating a custom templateWordPress Custom exerpts with excerpt length and excerpt moreWordPress Custom Post TypesWordPress Customizer Basics (Add Panel, Section, Setting, Control)WordPress Customizer Hello WorldWordPress DebuggingWordPress Enqueuing scriptsWordPress Enqueuing StylesWordPress Function : wp trim words()WordPress Function: add action()WordPress get bloginfo()WordPress get home path()WordPress get option()WordPress get permalink()WordPress get template part()WordPress get the category()WordPress get the title()WordPress home url()WordPress How Can I integrate Markdown editor with Advance Custom Fields repeater Add-on.WordPress initWordPress Installation and ConfigurationWordPress Making network requests with HTTP APIWordPress Meta BoxWordPress Options APIWordPress Plugin creationWordPress Plugin developmentWordPress Post FormatsWordPress Querying postsWordPress Remove Auto Line Breaks from Content and ExcerptWordPress REST APIWordPress Secure your installationWordPress ShortcodeWordPress Shortcode with attributeWordPress ShortcodesWordPress SidebarsWordPress Site MigrationWordPress TaxonomiesWordPress Template hierarchyWordPress template includeWordPress the $wpdb ObjectWordPress the Admin Bar (aka The Toolbar)WordPress the title()WordPress theme and child-theme developmentWordPress ThemesWordPress wp get current user()WordPress WP Query() LoopWordPress WP-CLIWordPress WP-Cron

WordPress Plugin creation

From WikiOD

WordPress plugins should have a focus on the server logic and/or admin parts of your website application. Good plugins are like good apps, they do one thing really well. They are intended to enhance and automate parts of the CMS in a modular way, since you can activate and deactivate them. Good plugins make use of WordPress core actions, filters, and existing javascript and css frameworks.

Minimal Setup of a Plugin Folder and Files[edit | edit source]

First step of creating a plugin is creating the folder and file which the plugin will load from.

Plugins are located in /wp-content/plugins/.

The WordPress standard is to create a folder and filename that mirror each other like so:


After creating your plugin file you need to start your plugin with a Plugin Header. This allows WordPress to scan your plugin file and store the meta data about the plugin, and allow users to use this and determine if they want your plugin active, or inactive. Copy this template into the top of your main plugin file you created, and modify it as needed:

 * Plugin Name: PLUGIN-NAME
 * Version: 0.0.1
 * License: GNU General Public License v2 or later
 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: short_prefix

// Begin custom PHP WordPress plugin work

Note that WordPress plugins should typically be licensed as GPL. Licensing should not be discussed as part of this topic though.

At this point, you should already by able to see your new plugin in the WordPress Admin area. In a standard setup you would locate this area at /wp-admin/plugins.php. Go ahead and activate your plugin, and you are ready move into the next steps of building your plugin!

Just to end our example on something actionable, you could now add the following to the bottom of your plugin file:

die('My custom plugin is loaded : '. __FILE__);

Refreshing your site after this change should result in all pages printing this text. Never do this in production (live) sites, and always remember to take this back out before continuing.