Plugin File Structure

A WordPress plugin is just a PHP file with a specific header comment. Create wp-content/plugins/my-plugin/my-plugin.php and add the plugin header with Name, Description, Version, and Author.

Hooks: Actions & Filters

WordPress is built on hooks. add_action() lets you execute code at specific points. add_filter() lets you modify data. Master these and you can do anything in WordPress.

Custom Post Types

Register custom post types to add new content types beyond posts and pages. Use register_post_type() in an init action. Add custom meta boxes for additional fields.

Shortcodes

Shortcodes let users add dynamic content with simple tags like [my-shortcode]. Register them with add_shortcode('name', 'callback_function').

Settings API

The Settings API provides a standardised way to add options pages and settings fields. It handles nonces, sanitisation, and storage automatically — always use it for admin forms.