2. Core Meta Fields | SEO Forge - Rank Higher with AI-Powered SEO
Download Log in

2. Core Meta Fields

Developer Guide

These are the fundamental SEO fields stored on every post/page as standard WordPress post_meta with the _seoforge_ prefix.

Meta KeyTypeDescription
_seoforge_meta_titlestringCustom SEO title override. When set, bypasses the template system entirely.
_seoforge_meta_descriptionstringCustom meta description override. Maximum recommended length: 160 characters.
_seoforge_focus_keywordstringFocus keyword used for on-page analysis. Used by the content scorer and internal link suggestions.
_seoforge_noindexstring ('1' or '')When '1', adds noindex to the robots meta tag and excludes from sitemap.
_seoforge_nofollowstring ('1' or '')When '1', adds nofollow to the robots meta tag.
php
// ----- Reading core meta -----

$post_id = 42;

// Read the custom SEO title (returns empty string if not set)
$title = get_post_meta( $post_id, '_seoforge_meta_title', true );

// Read the meta description
$desc = get_post_meta( $post_id, '_seoforge_meta_description', true );

// Read the focus keyword
$keyword = get_post_meta( $post_id, '_seoforge_focus_keyword', true );

// Check if the post is set to noindex
$is_noindex  = get_post_meta( $post_id, '_seoforge_noindex', true ) === '1';
$is_nofollow = get_post_meta( $post_id, '_seoforge_nofollow', true ) === '1';
php
// ----- Writing core meta -----

$post_id = 42;

// Set a custom SEO title (overrides template system)
update_post_meta( $post_id, '_seoforge_meta_title', 'Best WordPress SEO Plugin 2024 | MyBlog' );

// Set a meta description (keep under 160 chars for best results)
update_post_meta(
    $post_id,
    '_seoforge_meta_description',
    'Complete guide to optimizing your WordPress site for search engines. Covers on-page SEO, schema markup, and performance tips.'
);

// Set focus keyword (used in scoring analysis)
update_post_meta( $post_id, '_seoforge_focus_keyword', 'wordpress seo' );

// Enable noindex (hide from search engines)
update_post_meta( $post_id, '_seoforge_noindex', '1' );

// Remove noindex (make visible to search engines again)
update_post_meta( $post_id, '_seoforge_noindex', '' );

Example: bulk-setting meta descriptions from an external CSV import:

php
$csv_data = [
    42 => 'Learn WordPress SEO techniques that actually work in 2024.',
    55 => 'Step-by-step guide to WooCommerce product page optimization.',
    78 => 'How to set up Google Search Console for your WordPress site.',
];

foreach ( $csv_data as $post_id => $description ) {
    if ( get_post_status( $post_id ) === 'publish' ) {
        update_post_meta( $post_id, '_seoforge_meta_description', sanitize_text_field( $description ) );
        SEOFORGE_Analyzer::instance()->analyze( $post_id );
    }
}

Forge AI Assistant Online

Hi! I'm the SEO Forge AI assistant. Ask me anything about the plugin — setup, features, troubleshooting, or development.

Just now
Powered by Forge AI · Browse docs