18. Robots Meta | SEO Forge - Rank Higher with AI-Powered SEO
Download Log in

18. Robots Meta

Developer Guide

Per-post, per-taxonomy, and per-archive noindex/nofollow control via the HTML tag. FREE feature.

How It Works

SEOFORGE_Robots_Meta filters WordPress core’s wp_robots directives instead of printing a second robots tag. It evaluates the current page and merges SEO Forge visibility settings into the single core output:
  • Singular pages: reads _seoforge_noindex and _seoforge_nofollow from post_meta
  • Category/tag/taxonomy archives: reads from term_meta
  • Post type archives: reads from seoforge_archive_robots option

If neither is set, SEO Forge leaves the page indexable. Existing core directives still win: when WordPress Settings > Reading > Discourage search engines from indexing this site sets blog_public = 0, the final robots output remains noindex, nofollow regardless of SEO Forge per-post defaults.

Programmatic Control

php
$post_id = 42;

// Set noindex on a specific post
update_post_meta( $post_id, '_seoforge_noindex', '1' );
update_post_meta( $post_id, '_seoforge_nofollow', '1' );

// Check via public API
$is_noindex = SEOFORGE_Robots_Meta::is_noindex( $post_id );

// Taxonomy term robots control
$term_id = 15;
update_term_meta( $term_id, '_seoforge_noindex', '1' );

// Post type archive robots control
$archive_robots = get_option( 'seoforge_archive_robots', [] );
$archive_robots['product'] = [ 'noindex' => true ];
update_option( 'seoforge_archive_robots', $archive_robots );
php
// Bulk operations: noindex all posts with a specific tag
$tag_posts = get_posts( [
    'tag'            => 'deprecated',
    'posts_per_page' => -1,
    'fields'         => 'ids',
] );

foreach ( $tag_posts as $pid ) {
    update_post_meta( $pid, '_seoforge_noindex', '1' );
}

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