• About Us
  • Newsletter
    • Archive
  • T&Cs
  • Privacy Policy
  • Contact Us
  • HPL
  • Instagram
  • LinkedIn
  • TikTok
  • Twitter/X
  • Reddit

SMBtech

Menu
  • Blog
    • The NickRossTech Column
  • Features
  • News
  • Reactions
  • Thought Leadership
  • Blog
    • The NickRossTech Column
  • Features
  • News
  • Reactions
  • Thought Leadership
Home
Features
How To Add Meta Title And Meta Description Fields To A WordPress Post Without Using A Big SEO Plugin
How To Add Meta Title And Meta Description To A Web Page Without Using A Big SEO Plugin

How To Add Meta Title And Meta Description Fields To A WordPress Post Without Using A Big SEO Plugin

Nick Ross August 30, 2026 Features, NickRossTech

Surprisingly Useful AI Article Enhancements

I get many guest posters asking to add specific meta titles and descriptions to articles but I removed all the big SEO plugins (Yoast, Rank Math etc) that most people use to facilitate this. But, now I’ve a client insisting on adding them or they won’t pay.

I don’t want to add a big SEO plugin to SMBtech as I got paranoid when Google obliterated sites like High Performance Laptops for (seemingly) following best practice rules about web publishing. Us journos certainly don’t follow most rules when publishing articles. So, I’ve got it in my head that being genuine is what matters most to readers… and to Google. Also, it felt like whenever I bothered to add a meta title and description, Google ignored them anyway and made up its own. Also also, big SEO plugins have a bunch of duplicate features that can cause other problems. So, what did I do?

Claude (once again) came to the rescue – and while I didn’t want to add another plug-in Claude explained why I should in this case: you can add code to the functions.php file in WordPress, but any theme updates could overwrite this. Using a child theme is the obvious solution here, but I really like to keep things as basic as possible as I’ve had issues with updating altered child themes in the past. I prefer to use raw themes that have been tested by experts before deployment and I’m more of a web tinkerer who can build functional websites than a code monkey. So, Claude talked me into using a small code-injecting plugin.

In reality I’ve overcomplicated things by creating three steps (you can just paste 3b into your functions.php file), but if you’re looking at this article you’ve probably got some form of coding-related OCD and anxiety about adding something to your entire site, so I’ve included the justifications and outcome of a lengthy Claude conversation to settle any nerves.

Instructions

  • Step 1 Install Code Snippets Plugin
  • Step 2 Identify if your existing theme has title-tag support
  • Step 3a If Yes: Open Code Snippets and do this:
    • Code if your theme already has title-tag support
  • Step 3b If No: Open Code Snippets and do this:
    • Code if your theme DOES NOT HAVE title-tag support
  • Image of Code Snippets Plugin
  • Here's what it now looks like when creating a new post

Step 1 Install Code Snippets Plugin

Find it here. You don’t need the Pro version for this.

Step 2 Identify if your existing theme has title-tag support

Open Claude (or your favourite AI) and paste:

Does my website at [your URL here] have title-tag support? Check the page source.

Step 3a If Yes: Open Code Snippets and do this:

  1. In Code Snippets, click Add New.

  2. Give it a name like “Custom Meta Title and Description”.

  3. Paste the below code above into the code box.

  4. Click Save Changes and Activate.

  5. Now open any post or page in the editor. Scroll down below the content area — you’ll see two new boxes: Meta Title and Meta Description. Fill in whichever you need on that post. Leave them blank on posts that don’t need them and the defaults will apply as normal.

  6. Update/publish the post.

Code if your theme already has title-tag support

// --- Custom Meta Title ---
add_filter('pre_get_document_title', function ($title) {
    if (is_singular()) {
        $custom = get_post_meta(get_the_ID(), 'custom_meta_title', true);
        if ($custom) return $custom;
    }
    return $title;
});
// --- Custom Meta Description: Add the text box to the editor ---
add_action('add_meta_boxes', function () {
    add_meta_box('meta_desc_box', 'Meta Description', 'smbtech_render_meta_desc_box', ['post', 'page']);
});
function smbtech_render_meta_desc_box($post) {
    $value = get_post_meta($post->ID, 'custom_meta_description', true);
    wp_nonce_field('save_meta_desc', 'meta_desc_nonce');
    echo '<textarea name="custom_meta_description" style="width:100%;" rows="3" placeholder="Enter a meta description for this post...">' . esc_textarea($value) . '</textarea>';
}
// --- Custom Meta Description: Save it when the post is saved ---
add_action('save_post', function ($post_id) {
    if (!isset($_POST['meta_desc_nonce']) || !wp_verify_nonce($_POST['meta_desc_nonce'], 'save_meta_desc')) return;
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;
    if (isset($_POST['custom_meta_description'])) {
        update_post_meta($post_id, 'custom_meta_description', sanitize_textarea_field($_POST['custom_meta_description']));
    }
});
// --- Custom Meta Description: Output it in the page head ---
add_action('wp_head', function () {
    if (is_singular()) {
        $desc = get_post_meta(get_the_ID(), 'custom_meta_description', true);
        if ($desc) {
            echo '<!-- Custom Meta -->' . "\n";
            echo '<meta name="description" content="' . esc_attr($desc) . '">' . "\n";
            echo '<!-- / Custom Meta -->' . "\n";
        }
    }
});
// --- Custom Meta Title: Add the text box to the editor ---
add_action('add_meta_boxes', function () {
    add_meta_box('meta_title_box', 'Meta Title', 'smbtech_render_meta_title_box', ['post', 'page']);
});
function smbtech_render_meta_title_box($post) {
    $value = get_post_meta($post->ID, 'custom_meta_title', true);
    wp_nonce_field('save_meta_title', 'meta_title_nonce');
    echo '<input type="text" name="custom_meta_title" style="width:100%;" value="' . esc_attr($value) . '" placeholder="Leave blank to use the default post title..." />';
}
// --- Custom Meta Title: Save it when the post is saved ---
add_action('save_post', function ($post_id) {
    if (!isset($_POST['meta_title_nonce']) || !wp_verify_nonce($_POST['meta_title_nonce'], 'save_meta_title')) return;
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;
    if (isset($_POST['custom_meta_title'])) {
        update_post_meta($post_id, 'custom_meta_title', sanitize_text_field($_POST['custom_meta_title']));
    }
});

Step 3b If No: Open Code Snippets and do this:

  1. In Code Snippets, click Add New.

  2. Give it a name like “Custom Meta Title and Description”.

  3. Paste the below code above into the code box.

  4. Click Save Changes and Activate.

  5. Now open any post or page in the editor. Scroll down below the content area — you’ll see two new boxes: Meta Title and Meta Description. Fill in whichever you need on that post. Leave them blank on posts that don’t need them and the defaults will apply as normal.

  6. Update/publish the post.

Code if your theme DOES NOT HAVE title-tag support

// --- Add title-tag support (skip if your theme already has it) ---
add_theme_support('title-tag');
// --- Custom Meta Title ---
add_filter('pre_get_document_title', function ($title) {
    if (is_singular()) {
        $custom = get_post_meta(get_the_ID(), 'custom_meta_title', true);
        if ($custom) return $custom;
    }
    return $title;
});
// --- Custom Meta Description: Add the text box to the editor ---
add_action('add_meta_boxes', function () {
    add_meta_box('meta_desc_box', 'Meta Description', 'smbtech_render_meta_desc_box', ['post', 'page']);
});
function smbtech_render_meta_desc_box($post) {
    $value = get_post_meta($post->ID, 'custom_meta_description', true);
    wp_nonce_field('save_meta_desc', 'meta_desc_nonce');
    echo '<textarea name="custom_meta_description" style="width:100%;" rows="3" placeholder="Enter a meta description for this post...">' . esc_textarea($value) . '</textarea>';
}
// --- Custom Meta Description: Save it when the post is saved ---
add_action('save_post', function ($post_id) {
    if (!isset($_POST['meta_desc_nonce']) || !wp_verify_nonce($_POST['meta_desc_nonce'], 'save_meta_desc')) return;
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;
    if (isset($_POST['custom_meta_description'])) {
        update_post_meta($post_id, 'custom_meta_description', sanitize_textarea_field($_POST['custom_meta_description']));
    }
});
// --- Custom Meta Description: Output it in the page head ---
add_action('wp_head', function () {
    if (is_singular()) {
        $desc = get_post_meta(get_the_ID(), 'custom_meta_description', true);
        if ($desc) {
            echo '<!-- Custom Meta -->' . "\n";
            echo '<meta name="description" content="' . esc_attr($desc) . '">' . "\n";
            echo '<!-- / Custom Meta -->' . "\n";
        }
    }
});
// --- Custom Meta Title: Add the text box to the editor ---
add_action('add_meta_boxes', function () {
    add_meta_box('meta_title_box', 'Meta Title', 'smbtech_render_meta_title_box', ['post', 'page']);
});
function smbtech_render_meta_title_box($post) {
    $value = get_post_meta($post->ID, 'custom_meta_title', true);
    wp_nonce_field('save_meta_title', 'meta_title_nonce');
    echo '<input type="text" name="custom_meta_title" style="width:100%;" value="' . esc_attr($value) . '" placeholder="Leave blank to use the default post title..." />';
}
// --- Custom Meta Title: Save it when the post is saved ---
add_action('save_post', function ($post_id) {
    if (!isset($_POST['meta_title_nonce']) || !wp_verify_nonce($_POST['meta_title_nonce'], 'save_meta_title')) return;
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;
    if (isset($_POST['custom_meta_title'])) {
        update_post_meta($post_id, 'custom_meta_title', sanitize_text_field($_POST['custom_meta_title']));
    }
});

Claude points out that the first add_theme_support('title-tag') line is the only difference and that if a theme already declares it, having it twice is harmless – WordPress just ignores the duplicate.

Image of Code Snippets Plugin

Code Snippets details.

Here’s what it now looks like when creating a new post

How To Add Meta Title And Meta Description To A Web Page Without Using A Big SEO Plugin
Optional Meta Title And Meta Description boxes in a WordPress post.

Thank you Claude (again).

Last Updated on August 30, 2026 by Nick Ross

Surprisingly Useful AI Article Enhancements

Sign-up to the SMBtech Daily Newsletter

We will not spam you. You can easily unsubscribe any time. Read our privacy policy.

Please check your inbox or spam folder to confirm your subscription.

Share Share Pin it Reddit Tweet WhatsApp

Related Posts

Acer Nitro V 16 Laptop Review

Acer Nitro V 16 Laptop Review

How AI, LiDAR And 547 Million Pixels Powered The Projections Behind Vivid Sydney 2026

How AI, LiDAR And 547 Million Pixels Powered The Projections Behind Vivid Sydney 2026

A Cut Above: Meet the French brand disrupting China’s diamond market

A Cut Above: Meet the French brand disrupting China’s diamond market

About The Author

Nick Ross

Nick Ross is a veteran tech journalist. He is Editor in Chief of SMBtech, an Australian-based website for technology and business, and High Performance Laptops.

Tags:AI Coding, Claude, Coding, Metadata, Plugins, WordPress

*NEW*
Internet Speed Test
Mobile Internet Coverage Map

Recent Posts

  • Malaysian Gamified Marketing Platform RewardinMe Expands Into Myanmar With E-Wallet Campaign
  • SiteGround Adds Node.js Hosting To Existing Plans At No Extra Cost
  • XBOW Earns Google’s First $250,000 Chrome Bug Bounty Of 2026
  • How A 140-Year-Old Whisky Maker Found $10 Million In Savings With AI
  • Cadillac F1 CIO, Chris Green, Explains The Importance Of The Team’s IFS AI Partnership

Featured Posts

  • Youtubers Rick Beato And ‘Legal Eagle’ Devin Stone Launch Claim Fighter To Battle Fake And Malicious Copyright Strikes For Creators Like Davey504
  • UN Report Declares 1.5°C Warming Limit Will Be Breached, Warns Of Irreversible Harm To Pacific And Beyond
  • How To Add Meta Title And Meta Description Fields To A WordPress Post Without Using A Big SEO Plugin
  • Fake Police Phone Scammers Target Australians During National Scams Week
  • The Top 40 Best Laptops in Australia (Updated August 2026 Group Test)

Popular Posts

  • Seedance 2.5 AI Video Generator Vs A Stitched Product Demo
  • How To Build Infrastructure For An AI World In Motion
  • How To Choose The Right Turn Key Racing Simulator For You
  • How AML/CTF Software For Lawyers Builds A Risk-Based Compliance Program
  • IFS Rolls Out AI Platform To Bridge The Gap Between Industrial Data …

Digistylist is back.
Check it out!

2023 2024 2026 ACCC Adobe Ai Agents AMD Artificial Intelligence (A.I.) Asus Business Cars and Automotive Casinos CEO ChatGPT Cloud Cryptocurrency Cybersecurity eCommerce Enterprise FinTech Gambling Gaming GenAi Government HealthTech HR (Human Resources) Human Capital Management (HCM) Intel Laptops Large Language Models (LLMs) Lenovo Marketing Martech Melbourne Microsoft Nvidia Payments Phones Research Retail Security SMB (Small-to-Medium Business) Sustainability Sydney Ultraportable

Editor's Choice

  • Youtubers Rick Beato And ‘Legal Eagle’ Devin Stone Launch Claim Fighter To Battle Fake And Malicious Copyright Strikes For Creators Like Davey504
  • The Top 40 Best Laptops in Australia (Updated August 2026 Group Test)
  • How Full Alien Disclosure Could Make Trump Bigger Than Jesus, Stop Climate Collapse, Fix The Power & Economics Surrounding AI Data Centres And Pose Awkward Questions For King Charles
  • Business Laptop Group Test: The Best For Work, School and Play in Australia in October 2025
  • Lenovo Yoga 7i 2-in-1 Review (Gen 10 | 2025)
SMBtech Copyright © 2026.