Category: Uncategorized

  • How to Connect Claude Desktop to WordPress with the MCP Adapter

    How to Connect Claude Desktop to WordPress with the MCP Adapter

    AI assistants are only useful as what they can reach, and for most WordPress site owners that has meant copying and pasting between a chat window and wp-admin. WordPress’s official MCP Adapter removes that step. It lets clients like Claude work with your site directly, whether that means reading site details or creating draft posts.

    This guide is for WordPress owners, developers, and content teams who want to try AI-assisted workflows without building a custom integration.

    In this post, we’ll walk through installing the MCP Adapter, creating an application password, and connecting Claude Desktop.

    What Is the MCP Adapter, and Why Does It Matter?

    Three pieces work together here:

    • MCP (Model Context Protocol) is and open standard that lets AI apps like Claude connect to outside tools and data in a consistent way. Instead of every app building its own integration, a tool exposes itself once as an MCP server and any compatible client can use it.
    • The Abilities API is WordPress’s built-in way (as of 6.9) for plugins and core to register the things the site can do, such as “create a post” or “get site info”. Each ability has a name, a description, and a defined set of inputs and outputs/
    • The MCP Adapter is the official plugin that connects the two. It takes the abilities registered on your site and exposes them over MCP, so an AI client can discover them and call them.

    Out of the box, the adapter gives clients three tools: one to discover abilities, one to get the details of a specific ability, and one to execute it. The adapter doesn’t decide what the AI can do. The abilities you register do.

    Why It Matters

    • No more copy-paste: AI can act on your site directly instead of handing you text to move into the dashboard.
    • You control the scope. AI can only do what has been registered as an ability, and only with the permissions of the WordPress user it logs in as. A create-post ability that defaults to drafts, for example, keeps a human in the loop before anything goes live.
    • It’s built on standards. Because it uses MCP and WordPress’s own API, the same setup works with other compatible clients, not just Claude.

    What You Need

    • WordPress 6.9 or later, on a site with HTTPS
    • Claude Desktop and Node.js (for npx)
    • An admin account to create the credentials

    1. Install the plugin

    Install and activate MCP Adapter from the plugin directory.

    search result of mcp adopter plugin

    Find the plugin “MCP Adapter” by WordPress.org

    Or with WP-CLI:

    wp plugin install https://github.com/WordPress/mcp-adapter/releases/latest/download/mcp-adapter.zip --activate

    2. Create an application password

    user profile application password

    Go to Users → Profile → Application Passwords, name it “Claude”, and copy the password. Use a dedicated user with only the permissions you want the AI to have, because the password carries that user’s capabilities.

    3. Configure Claude Desktop

    Go to Settings -> Developer -> Edit Config

    Claude Desktop Edit Config

    Add this to claude_desktop_config.json:

    {
      "mcpServers": {
        "wordpress": {
          "command": "npx",
          "args": ["-y", "@automattic/mcp-wordpress-remote@latest"],
          "env": {
            "WP_API_URL": "https://your-site.com/wp-json/mcp/mcp-adapter-default-server",
            "WP_API_USERNAME": "your-username",
            "WP_API_PASSWORD": "your application password"
          }
        }
      }
    }

    Fully quit and reopen Claude Desktop, then start a new chat.

    4. Test it

    Ask Claude to call mcp-adapter-discover-abilities. A working setup lists the abilities your site exposes. Out of the box that’s only a few read-only core ones (site info, user info, environment info).

    Troubleshooting: The 401 Rest_Forbidden Error

    My first attempt failed with a 401 even though the plugin was working. The cause was an http:// URL. WordPress disables application passwords on non-HTTPS sites, and redirects can drop the Authorization header. Switching WP_API_URL to https:// fixed it. If you still see 401, check the username, the full password, and any security plugin or host rule that strips auth headers.

    5. Add real abilities

    The adapter only bridges abilities. Plugins or your own code must register them, for example a create-post ability that makes draft posts.

    Here is an example from the plugin repository

    https://github.com/WordPress/mcp-adapter/blob/trunk/docs/getting-started/basic-examples.md

    <?php
    // Register the ability
    add_action( 'wp_abilities_api_init', function() {
        wp_register_ability( 'my-plugin/create-post', [
            'label' => 'Create Post',
            'description' => 'Creates a new WordPress post with the specified content',
            'category' => 'site',
            'input_schema' => [
                'type' => 'object',
                'properties' => [
                    'title' => [
                        'type' => 'string',
                        'description' => 'The post title',
                        'minLength' => 1,
                        'maxLength' => 200
                    ],
                    'content' => [
                        'type' => 'string',
                        'description' => 'The post content (HTML allowed)',
                        'minLength' => 1
                    ],
                    'status' => [
                        'type' => 'string',
                        'description' => 'Post status',
                        'enum' => ['draft', 'publish'],
                        'default' => 'draft'
                    ],
                    'category' => [
                        'type' => 'string',
                        'description' => 'Category name (optional)'
                    ]
                ],
                'required' => ['title', 'content']
            ],
            'output_schema' => [
                'type' => 'object',
                'properties' => [
                    'post_id' => [
                        'type' => 'integer',
                        'description' => 'The ID of the created post'
                    ],
                    'post_url' => [
                        'type' => 'string',
                        'description' => 'The URL of the created post'
                    ],
                    'edit_url' => [
                        'type' => 'string',
                        'description' => 'The admin edit URL'
                    ]
                ]
            ],
            'execute_callback' => function( $input ) {
                if ( empty( $input['title'] ) ) {
                    return new \WP_Error( 'missing_title', 'Post title is required.' );
                }
    
                $post_data = array(
                    'post_title'   => sanitize_text_field( $input['title'] ),
                    'post_content' => wp_kses_post( $input['content'] ),
                    'post_status'  => in_array( $input['status'], array( 'draft', 'publish' ), true ) ? $input['status'] : 'draft',
                    'post_type'    => 'post',
                );
                
                // Handle category if provided
                if ( ! empty( $input['category'] ) ) {
                    $category = get_category_by_slug( sanitize_title( $input['category'] ) );
                    if ( ! $category ) {
                        // Create category if it doesn't exist
                        $category_id = wp_create_category( $input['category'] );
                    } else {
                        $category_id = $category->term_id;
                    }
                    $post_data['post_category'] = [ $category_id ];
                }
                
                $post_id = wp_insert_post( $post_data );
                
                if ( is_wp_error( $post_id ) ) {
                    throw new Exception( 'Failed to create post: ' . $post_id->get_error_message() );
                }
                
                return [
                    'post_id' => $post_id,
                    'post_url' => get_permalink( $post_id ),
                    'edit_url' => get_edit_post_link( $post_id, 'raw' )
                ];
            },
            'permission_callback' => function() {
                return current_user_can( 'publish_posts' );
            },
            'meta' => [
                'public' => true, // Expose to clients, including MCP
                'annotations' => [
                    'priority' => 2.0,
                    'readOnlyHint' => false,
                    'destructiveHint' => false
                ]
            ]
        ]);
    });

    You can make this as a plugin and add it to your website.

    Closing

    Now you can use AI to manage your WordPress website.

    It is a new feature so the ecosystem around this is not that big now, so keep that it mind when finding abilities.

    You can find more information on

  • WordPress Classic Theme Vs Block Theme: Which One Should You Use?

    WordPress Classic Theme Vs Block Theme: Which One Should You Use?

    If you’ve set up WordPress lately, you’ve probably seen two distinct ways to design a site. Some themes send you to the Customizer, a settings panel with a live preview. Others send you to the Site Editor, where you build your header, footer, and page layouts with blocks.

    Both are WordPress themes, and both can look great. But they work in very different ways, and picking the wrong one can cost you time. This guide explains the classic theme vs block theme difference, what each one does well, and how to choose.

    What Is a Classic Theme?

    A classic theme uses PHP template files to decide how your site looks. Files like index.php, single.php, and header.php control each part of a page. PHP is the programming language WordPress runs on.

    Classic themes come with their own set of tools:

    • The Customizer (Appearance > Customize): a panel where you change colors, fonts, logos, and menus with a live preview.
    • Widgets: small content boxes you place in sidebars and footers.
    • Menus: a separate screen for building navigation.
    • Theme File Editor: a place to edit the theme’s code from the dashboard.
    WordPress Customizer showing a live preview of a classic theme.

    WordPress has supported this system since 2005, and it’s still fully supported. If you’ve used WordPress for a while, this is probably the setup you know.

    What Is a Block Theme?

    A block theme builds the whole site out of blocks. You already use blocks to write posts. Paragraphs, images, buttons, and columns are all blocks. With a block theme, your header, footer, navigation, and page templates use blocks too.

    Block themes arrived in WordPress 5.9 in 2022. Their theme files are mostly HTML, and a theme.json file stores global settings for colors, fonts, and spacing. You do most of your design work in the Site Editor (Appearance > Editor). The Customizer is hidden by default, because blocks cover the same settings, like the site title, tagline, and logo.

    Classic theme vs block theme: key differences

    Classic themeBlock theme
    Template filesPHP (index.php, single.php)HTML with block markup (templates/index.html)
    Main design toolCustomizerSite Editor
    Header and footerSet in code, the Customizer, or widgetsTemplate parts you edit with blocks
    WidgetsSupportedReplaced by blocks
    Global colors and fontsCustomizer or codetheme.json and the Styles panel
    Required filesstyle.css, index.phpstyle.css, templates/index.html
    Code neededBasic PHP, HTML, and CSSLittle to none for basic changes
    Best forDevelopers who need custom logicSite owners who want visual control

    How the pieces fit together

    A block theme splits your site into a few parts. Here’s what each one does:

    • Page or post: the content you write.
    • Template: the layout for a type of content, such as single posts, pages, or the 404 error page.
    • Template part: a reusable section, like the header or footer. Edit it once, and every template that uses it updates.
    • Pattern: a ready-made group of blocks you can insert into your content.
    • Blocks: the pieces that fill templates and content.
    • Styles: colors, fonts, and spacing. They come from WordPress defaults, the theme’s theme.json file, and your changes in the Styles panel. Your changes win.

    Here’s how they work together. When a reader opens a blog post, WordPress picks the Single Posts template, adds the header and footer parts, fills in the blocks with the post’s content, and applies the styles. So the post matches your colors and fonts.

    Here’s how the files compare in a typical theme (simplified):

    Classic theme

    my-classic-theme/
    ├── style.css
    ├── index.php
    ├── functions.php
    ├── header.php
    ├── footer.php
    ├── single.php
    ├── page.php
    └── sidebar.php

    Block theme

    my-block-theme/
    ├── style.css
    ├── theme.json
    ├── functions.php
    ├── templates/
    │   ├── index.html
    │   ├── single.html
    │   └── page.html
    ├── parts/
    │   ├── header.html
    │   └── footer.html
    ├── patterns/
    └── styles/

    How editing works in each

    In a classic theme, you usually change blog post layouts by editing single.php or adding CSS in the Customizer. The Customizer preview helps with colors and fonts. Layout changes often need code or a plugin.

    In a block theme, open Appearance > Editor and choose the Single Posts template. Click the header to edit it, then change button styles under Styles. The change applies to every post. Need a different layout for one page? Create a custom template and pick it from the page settings.

    Site Editor showing the Single Posts template

    The block approach is more visual. The trade-off is that you need to learn how blocks, patterns, and template parts fit together.

    Code, plugins, and compatibility

    Classic themes give developers more room. PHP lets you run custom logic, hook into WordPress, and build almost anything. Most older plugins were written for this structure, so they usually work well.

    Block themes lean on HTML and JSON instead. Most basic changes don’t need code. But plugins that add Customizer settings, rely on widget areas, or hook into PHP templates may not work the same way. Check compatibility before you switch.

    Does your theme choice affect SEO?

    Neither type helps you rank by default. Google looks at content quality, page speed, mobile experience, and clear page structure. Your theme affects those things, so focus on three areas:

    • Speed: Test your homepage and one key post with Google PageSpeed Insights. Heavy themes and too many plugins slow pages down.
    • Heading structure: Use one H1 per page. Some block templates add extra headings, so check your site title and template headings after you switch.
    • Mobile layout: Preview your site on a phone. Both theme types can be responsive, but a poor setup can break the layout.

    Which One Should You Choose?

    Choose a block theme if:

    • You’re starting a new site.
    • You want to change headers, footers, and layouts without writing code.
    • You’re comfortable with the block editor.
    • The plugins you need support block themes.

    Choose a classic theme if:

    • You need custom PHP logic or deep theme hooks.
    • You rely on widgets, the Customizer, or plugins that only work with classic themes.
    • Your current classic theme works well and is still maintained. Block themes are newer, but that alone isn’t a reason to switch.

    Some themes mix both approaches. These “hybrid” themes use classic PHP templates along with block features, such as theme.json or template parts. They’re a good middle path if you’re not sure.

    Can you switch later?

    Yes, but plan the move. Your posts, pages, and comments live in the database, and your images stay in the media library. All of it carries over. The parts that usually need rework are:

    • Widgets: you’ll rebuild these with blocks.
    • Customizer settings: you’ll recreate these in the Styles panel.
    • Custom PHP templates: you’ll rebuild these as block templates.
    • Theme-specific shortcodes: layouts built with them will need new blocks or patterns.

    Back up your site first, and test the switch on a staging copy before you touch the live site.

    The Bottom Line

    The WordPress developer handbook calls block themes “the future of the WordPress project.” Classic themes still work and are fully supported, though. So the choice comes down to how you work. If you want visual control with blocks, go with a block theme. If you need code-level control or already have a classic setup that works, stay with classic.

    Either way, test before you commit.