WordPress does not output a meta description tag by default. Here is how to add one to improve your search result snippets and click-through rates.
Method 1: Yoast SEO (Recommended)
- Install and activate Yoast SEO.
- Edit any post or page.
- In the Yoast SEO meta box below the editor, click "Edit snippet".
- Write your meta description in the "Meta description" field.
- Aim for 120-160 characters — the green bar indicates the optimal length.
Yoast also automatically generates meta descriptions from the content if you don't write one manually.
Method 2: Rank Math
- Install and activate Rank Math.
- Edit a post or page.
- Click the Rank Math meta box and fill in the "Description" field.
Method 3: Custom Code
Add a meta description via functions.php:
function custom_meta_description() {
if (is_singular()) {
$description = has_excerpt() ? get_the_excerpt() : wp_trim_words(get_the_content(), 25);
echo '<meta name="description" content="' . esc_attr($description) . '" />' . "\n";
} elseif (is_front_page()) {
echo '<meta name="description" content="' . esc_attr(get_bloginfo('description')) . '" />' . "\n";
}
}
add_action('wp_head', 'custom_meta_description', 1);
Tips for Writing Effective Meta Descriptions
- Include a call-to-action (e.g., "Learn how...", "Discover...")
- Include the primary keyword naturally
- Make each description unique — no duplicates
- Accurately describe what the user will find on the page
Verify with InspectWP
Run an InspectWP scan — the SEO section shows your meta description content and length.