Wordpress Pro Guide: Usage, Examples, and Best Practices for Beginners
Purpose
This post demonstrates how to use the Wordpress Pro skill in Claude Code for platform development tasks.
Environment
- Claude Code with claude-skills plugin installed
- WordPress development environment
- Node.js for local development (optional)
The Wordpress Pro Skill
The Wordpress Pro skill provides specialized assistance for WordPress development within Claude Code. It helps with theme development, plugin creation, site architecture decisions, and WordPress-specific best practices.
The skill handles these main tasks:
- Theme and plugin development guidance
- WordPress API and hook usage
- Site architecture and performance optimization
- Debugging WordPress-specific issues
- Following WordPress coding standards
Installation and Setup
First, you need to install the claude-skills plugin if you haven’t already:
# Navigate to your Claude skills directorycd ~/.claude/skills
# Clone the repositorygit clone https://github.com/jeffallan/claude-skills.git
# The Wordpress Pro skill will be available in the skills listTo verify the installation, you can check available skills in Claude Code by asking:
What skills are available?You should see “wordpress-pro” listed among the available skills.
Core Usage Patterns
The Wordpress Pro skill activates automatically when you mention WordPress-related tasks. Here are common trigger phrases:
- “Create a custom WordPress theme”
- “Help me debug this WordPress plugin”
- “Optimize my WordPress site performance”
- “Implement a custom post type in WordPress”
- “Set up WordPress REST API endpoints”
When I use the skill, Claude switches to WordPress-specialized mode and applies WordPress-specific knowledge and coding standards.
Example 1: Creating a Custom Plugin
When I needed to create a custom WordPress plugin, I used this prompt:
Use wordpress-pro to create a plugin that adds a custom admin dashboard widgetThe skill guided me through creating this structure:
<?php/*Plugin Name: My Custom Dashboard WidgetVersion: 1.0Description: Adds a custom widget to the WordPress admin dashboardAuthor: Your Name*/
// Prevent direct accessif (!defined('ABSPATH')) { exit;}
class My_Custom_Dashboard { public function __construct() { add_action('wp_dashboard_setup', array($this, 'add_dashboard_widget')); }
public function add_dashboard_widget() { wp_add_dashboard_widget( 'my_custom_dashboard_widget', 'Custom Dashboard Widget', array($this, 'render_dashboard_widget') ); }
public function render_dashboard_widget() { echo '<p>Welcome to your custom dashboard widget!</p>'; }}
new My_Custom_Dashboard();The skill ensured I followed WordPress coding standards:
- Proper plugin header comments
- Direct access protection with ABSPATH
- Class-based structure for better organization
- Correct hook usage (wp_dashboard_setup)
- Sanitized output handling
Example 2: Registering a Custom Post Type
When I worked on a project needing a custom portfolio section, I asked:
Use wordpress-pro to register a custom portfolio post type with custom fieldsThe skill provided this implementation:
function register_portfolio_post_type() { $labels = array( 'name' => 'Portfolio Projects', 'singular_name' => 'Portfolio Project', 'menu_name' => 'Portfolio', 'add_new' => 'Add New', 'add_new_item' => 'Add New Project', 'edit_item' => 'Edit Project', 'new_item' => 'New Project', 'view_item' => 'View Project', 'search_items' => 'Search Projects', 'not_found' => 'No projects found', 'not_found_in_trash' => 'No projects found in Trash', );
$args = array( 'labels' => $labels, 'public' => true, 'has_archive' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'query_var' => true, 'rewrite' => array('slug' => 'portfolio'), 'capability_type' => 'post', 'supports' => array('title', 'editor', 'thumbnail', 'excerpt'), 'menu_icon' => 'dashicons-portfolio', );
register_post_type('portfolio', $args);}
add_action('init', 'register_portfolio_post_type');
// Register custom meta fieldsfunction register_portfolio_meta() { register_post_meta('portfolio', 'project_client', array( 'type' => 'string', 'description' => 'Client name', 'single' => true, 'show_in_rest' => true, ));
register_post_meta('portfolio', 'project_year', array( 'type' => 'integer', 'description' => 'Project year', 'single' => true, 'show_in_rest' => true, ));}
add_action('init', 'register_portfolio_meta');The skill showed me the key considerations:
- Complete label array for better UX
- Proper capability_type for permissions
- Rewrite rules for clean URLs
- Modern register_post_meta() instead of custom meta boxes
- REST API support for Gutenberg integration
Example 3: Theme Development with Template Hierarchy
When I created a custom theme, I asked:
Use wordpress-pro to set up a WordPress theme with custom template filesThe skill helped me understand the template hierarchy:
WordPress Theme Template Hierarchy:
Front Page├── front-page.php├── home.php└── index.php (fallback)
Single Post├── single-{post-type}.php├── single.php└── index.php (fallback)
Page├── page-{slug}.php├── page-{id}.php├── page.php└── index.php (fallback)
Archive├── archive-{post-type}.php├── archive.php└── index.php (fallback)Then it provided a starter theme structure:
/*Theme Name: My Custom ThemeTheme URI: https://example.comAuthor: Your NameAuthor URI: https://example.comDescription: A custom WordPress themeVersion: 1.0License: GNU General Public License v2 or laterLicense URI: http://www.gnu.org/licenses/gpl-2.0.htmlText Domain: my-custom-theme*/
// Enqueue styles and scriptsfunction my_theme_enqueue() { wp_enqueue_style('main-style', get_stylesheet_uri()); wp_enqueue_script('main-script', get_template_directory_uri() . '/js/main.js', array(), '1.0', true);}add_action('wp_enqueue_scripts', 'my_theme_enqueue');
// Theme supportfunction my_theme_setup() { add_theme_support('title-tag'); add_theme_support('post-thumbnails'); add_theme_support('html5', array('search-form', 'comment-form', 'gallery'));}add_action('after_setup_theme', 'my_theme_setup');The skill emphasized:
- Proper theme header in style.css
- Using wp_enqueue_scripts for assets
- Declaring theme support for modern features
- Following WordPress theme directory structure
Best Practices
DO:
- Always escape output using
esc_html(),esc_attr(), orwp_kses() - Sanitize input with
sanitize_text_field(),sanitize_email(), etc. - Use WordPress core functions instead of PHP equivalents
- Follow WordPress Coding Standards (WPCS)
- Use nonces for form verification
- Check capabilities before performing actions
- Use transients for caching expensive operations
DON’T:
- Don’t query posts directly with
get_posts()without considering performance - Don’t use
query_posts()- it breaks the main query - Don’t hardcode URLs or paths
- Don’t use
$_POSTor$_GETdirectly without sanitization - Don’t create custom database tables when post meta will work
- Don’t use
mysql_*ormysqli_*functions - use $wpdb - Don’t enqueue scripts/styles on every page if only needed on specific pages
Performance Tips:
When I worked on optimizing site performance, the skill suggested:
// Use transients for expensive operationsfunction get_expensive_data() { $data = get_transient('my_expensive_data');
if (false === $data) { // Expensive operation here $data = expensive_operation();
// Cache for 1 hour set_transient('my_expensive_data', $data, HOUR_IN_SECONDS); }
return $data;}
// Disable emoji scripts (if not needed)remove_action('wp_head', 'print_emoji_detection_script', 7);remove_action('wp_print_styles', 'print_emoji_styles');
// Limit post revisionsdefine('WP_POST_REVISIONS', 3);
// Disable autosave (use sparingly)define('AUTOSAVE_INTERVAL', 300); // 5 minutesCommon Troubleshooting
When I debug WordPress issues, I use this pattern:
Enable WP_DEBUG in wp-config.php// Enable debuggingdefine('WP_DEBUG', true);define('WP_DEBUG_LOG', true);define('WP_DEBUG_DISPLAY', false);
// Log to wp-content/debug.log@ini_set('log_errors', 1);@ini_set('error_log', WP_CONTENT_DIR . '/debug.log');Then check the debug log:
tail -f wp-content/debug.logCommon issues I’ve encountered:
- White screen of death: Usually a PHP fatal error - check debug log
- Styles not loading: Check
wp_enqueue_scriptshook priority and dependencies - Custom post type 404: Flush rewrite rules by visiting Settings > Permalinks
- Plugin conflicts: Disable all plugins, re-enable one at a time
Related Skills
The Wordpress Pro skill works well with other Claude Code skills:
- security-review: Validate plugin security before deployment
- php-patterns: Apply PHP best practices in WordPress code
- backend-patterns: Structure custom API endpoints properly
Summary
In this post, I showed how to use the Wordpress Pro skill in Claude Code for WordPress development tasks. The key point is knowing when to invoke this skill - any time you’re working on themes, plugins, or WordPress-specific functionality. The skill ensures you follow WordPress coding standards, use proper APIs and hooks, and implement best practices for security and performance.
Whether you’re creating custom plugins, developing themes, or optimizing site performance, the Wordpress Pro skill provides specialized guidance that general coding assistance can’t match.
Final Words + More Resources
My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me
Here are also the most important links from this article along with some further resources that will help you in this scope:
Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!
Comments