Updated 2026-11-23
WordPress SEO without a plugin: what core prints and what it leaves out
We checked 771 pages on 69 WordPress sites. Only 1% had no canonical link and 1% no lang, because WordPress prints those itself. But 37% had no meta description at all, and 23% had no Open Graph tags or no og:image, so a shared link shows no picture. 27% had no JSON-LD. WordPress core doesn't write any of those three. This guide shows exactly what core prints, adds the missing tags with one small file, and cleans up the sitemap.
Tested on WordPress 7.1.3 with the default Twenty Twenty-Five theme and no plugins, in a fresh install.
1. What WordPress prints with no SEO plugin
- Title: yes, from the theme (
Post title – Site name; the home page gets the site name, plus the tagline if you set one). langon<html>: yes, from Settings → General → Site Language.- Canonical: on single posts and pages only. The home page (when it lists your latest posts), category, tag, author and date archives get none.
- Robots:
max-image-preview:largeon every page, andnoindex, followon search results. With Settings → Reading → "Discourage search engines" ticked, every page getsnoindex: the most common reason a new site never shows up. - Sitemap:
/wp-sitemap.xml, listed in the virtualrobots.txt. It includes posts, pages, categories, tags and author archives. - Not printed at all: meta description, Open Graph, X (Twitter) cards and JSON-LD. Block themes don't add them either.
2. Add descriptions, Open Graph and JSON-LD
If you already run Yoast SEO, Rank Math, All in One SEO, SEOPress or The SEO Framework, you don't need this; it steps aside when one of them is active. Otherwise save the file below as wp-content/mu-plugins/seo-basics.php (create the folder if needed). Must-use plugins load automatically and survive theme switches, unlike code in a theme's functions.php.
<?php
/**
* Plugin Name: SEO basics
* Description: Meta description, Open Graph, X card and JSON-LD for sites without an SEO plugin.
*/
// Author archives leak login names and are rarely worth indexing.
add_filter( 'wp_sitemaps_add_provider', function ( $provider, $name ) {
return 'users' === $name ? false : $provider;
}, 10, 2 );
add_action( 'wp_head', function () {
// Yoast, Rank Math, AIOSEO, SEOPress and The SEO Framework print these tags themselves.
if ( defined( 'WPSEO_VERSION' ) || defined( 'RANK_MATH_VERSION' ) || defined( 'AIOSEO_VERSION' )
|| defined( 'SEOPRESS_VERSION' ) || defined( 'THE_SEO_FRAMEWORK_VERSION' ) ) {
return;
}
$site = get_bloginfo( 'name' );
// Both come back HTML-escaped (–, &); decode once so JSON-LD gets plain text.
$title = html_entity_decode( is_singular() ? single_post_title( '', false ) : wp_get_document_title(), ENT_QUOTES, 'UTF-8' );
$url = is_singular() ? get_permalink() : ( is_front_page() ? home_url( '/' ) : '' );
$desc = '';
$image = '';
if ( is_singular() ) {
$post = get_queried_object();
$desc = has_excerpt( $post ) ? $post->post_excerpt : $post->post_content;
if ( has_post_thumbnail( $post ) ) {
$image = get_the_post_thumbnail_url( $post, 'large' );
}
} elseif ( is_front_page() ) {
$desc = get_bloginfo( 'description' );
} elseif ( is_category() || is_tag() || is_tax() ) {
$desc = term_description();
}
$desc = wp_trim_words( wp_strip_all_tags( strip_shortcodes( $desc ), true ), 28, '…' );
if ( ! $image && has_site_icon() ) {
$image = get_site_icon_url( 512 );
}
if ( is_front_page() && ! is_singular() ) {
printf( '<link rel="canonical" href="%s" />' . "\n", esc_url( $url ) );
}
if ( $desc ) {
printf( '<meta name="description" content="%s" />' . "\n", esc_attr( $desc ) );
printf( '<meta property="og:description" content="%s" />' . "\n", esc_attr( $desc ) );
}
printf( '<meta property="og:title" content="%s" />' . "\n", esc_attr( $title ) );
printf( '<meta property="og:site_name" content="%s" />' . "\n", esc_attr( $site ) );
printf( '<meta property="og:type" content="%s" />' . "\n", is_single() ? 'article' : 'website' );
if ( $url ) {
printf( '<meta property="og:url" content="%s" />' . "\n", esc_url( $url ) );
}
if ( $image ) {
printf( '<meta property="og:image" content="%s" />' . "\n", esc_url( $image ) );
}
printf( '<meta name="twitter:card" content="%s" />' . "\n", $image ? 'summary_large_image' : 'summary' );
$ld = is_single()
? array(
'@context' => 'https://schema.org',
'@type' => 'BlogPosting',
'headline' => $title,
'datePublished' => get_the_date( 'c' ),
'dateModified' => get_the_modified_date( 'c' ),
'url' => $url,
)
: ( is_front_page() ? array(
'@context' => 'https://schema.org',
'@type' => 'Organization',
'name' => $site,
'url' => home_url( '/' ),
) : null );
if ( $ld ) {
if ( $image ) {
$ld[ is_single() ? 'image' : 'logo' ] = $image;
}
// wp_json_encode escapes "/" so a title can't close the script tag.
echo '<script type="application/ld+json">' . wp_json_encode( $ld ) . "</script>\n";
}
}, 1 );
- The description comes from the excerpt when a post has one, otherwise from the first 28 words of its content. Write excerpts for your important pages (the Excerpt panel in the block editor's post settings). The home page uses the tagline in Settings → General, so set one that says what you do and where.
- The preview image is the featured image, otherwise the Site Icon. Give important pages a featured image of about 1200×630; a square icon only gets the small
summarycard. - Decode the title once. WordPress returns titles HTML-escaped (
&for &, curly quotes as“). Withouthtml_entity_decode, those entities end up literally in the JSON-LD headline.wp_json_encodethen escapes/, so a title can't close the script tag.
3. Clean up the sitemap
- Author archives (
/author/admin/) are in the core sitemap and show the login name. The snippet'swp_sitemaps_add_providerfilter drops them from the sitemap; the archive pages themselves still load. - Leftover sample content: a fresh install ships "Hello world!" (
/hello-world/), "Sample Page" and the "Uncategorized" category, and all three are in the sitemap. Delete the first two and rename the category. We find them on live business sites regularly. - Attachment pages: since WordPress 6.4, new installs redirect attachment pages to the file. Sites installed earlier keep a thin page per uploaded image, often with no description. Check with
wp option get wp_attachment_pages_enabled;1means they are on, andwp option update wp_attachment_pages_enabled 0turns them off.
4. Check the result
curl -s https://example.com/ | grep -E -o '<(link rel="canonical"|meta (name|property)="(description|og:[a-z_]+|twitter:card)")[^>]*>'
curl -s https://example.com/wp-sitemap.xml | grep -o '<loc>[^<]*'
wp post list --post_type=post,page --fields=ID,post_title,post_excerpt --post_status=publish
The first shows the head tags of one page, the second the sitemap's sub-sitemaps (no users one after the clean-up), the third which posts still have no excerpt. A page cache serves the old HTML until it is cleared, so purge it after adding the file. To see a page the way Google and link previewers do, run it through the free SEO checker, or up to 50 pages from your sitemap through the site checker.
Automating it with Headlark
The snippet's descriptions are the first words of each page, which is better than nothing but rarely a good summary, and writing excerpts for hundreds of posts is the slow part. The Headlark plugin writes each post's title, description, Open Graph and X cards, JSON-LD and missing alt text from the post's own content when you publish or update it, and stores the result with the post, so nothing runs when a visitor loads the page.
- With Yoast SEO, Rank Math or another SEO plugin active, it adds only the tags that plugin doesn't print.
- Your canonical and robots tags are kept, and alt text you wrote stays.
Try it
Try it free for 14 days on one site and up to 500 pages, no card needed. Add your site, install the plugin and paste the site's key in Settings → Headlark.