Support Log in

30. Content Scorer

Developer Guide
Prefer video? Watch the Rank Forge tutorials 9 short guides covering every feature Watch

The content scorer powers the “SEO” column in the posts list table, the metabox score indicator, and the analysis API.

Score Display Colors

Score RangeColorHex
80-100 (Good)Green#059669
50-79 (Medium)Amber#D97706
0-49 (Bad)Red#DC2626

Rule-Based Scoring Algorithm (24 Checks)

The score starts at 0. Each of the 24 checks is worth a fixed number of points, set in RANKFORGE_Scorer::WEIGHTS, and the weights add up to 100 (Basic SEO 30, Additional 25, Title Readability 15, Content Readability 30). A check that passes adds its points. A graded check can add a part of them. A check that fails adds nothing, takes nothing away, and pushes an issue with the keys severity, message, group, points (what passing the check is worth) and code (the key in the table below). RANKFORGE_Scorer::score() is a pure function: it makes no WordPress calls and reads no database.

KeyGroupPointsPasses when
kw_in_titleBasic SEO5The focus keyword is in the SEO title. When no SEO title is set, the post title is used.
kw_in_descriptionBasic SEO4The meta description contains the focus keyword.
kw_in_urlBasic SEO3The URL slug contains the focus keyword. Hyphens and underscores count as spaces.
kw_in_introBasic SEO4The focus keyword is in the opening of the text: the first 300 characters, or the first tenth of the text when that is longer.
kw_in_contentBasic SEO4The focus keyword is somewhere in the body text.
content_lengthBasic SEO10600 words or more earns all 10 points. 300 to 599 words earns 7, 100 to 299 words earns 4, and fewer than 100 words earns 0.
kw_in_subheadingsAdditional4The focus keyword is in at least one heading from H2 to H6.
kw_in_altAdditional3The focus keyword is in the alt text of at least one image in the content.
kw_densityAdditional3The focus keyword is used 0.5% to 3% of the words of the text. For a keyword of several words, the count is taken from its least frequent word. It needs the keyword in the content, and there is no partial credit.
internal_linksAdditional4The content has at least one link to your own site.
external_linksAdditional3The content has at least one link to another site.
url_lengthAdditional3The URL slug is 75 characters or shorter. A post with no slug yet passes.
mediaAdditional5The post has an image or a video: in the content, as an image address in the content, or attached to the post.
title_lengthTitle Readability6The SEO title is 20 to 60 characters long: all 6 points. Shorter than 20 or longer than 60 characters: 3 points. No SEO title: 0.
kw_title_startTitle Readability3The focus keyword, or its first word, starts in the first half of the title.
title_numberTitle Readability3The title contains a digit. This is an optional idea, not a requirement.
title_power_wordTitle Readability3The title contains a word from the built-in list of power and emotional words, for example best, guide, how, free or ultimate. English posts only: a post in another language passes this check automatically. This is an optional idea, not a requirement.
description_lengthContent Readability6The meta description is 120 to 160 characters long: all 6 points. Shorter than 120 or longer than 160 characters: 3 points. No meta description: 0.
short_paragraphsContent Readability5No paragraph is longer than 150 words.
sentence_lengthContent Readability5The average sentence is 20 words or shorter: all 5 points. More than 20 and up to 25 words: 3 points. Longer than 25 words: 0.
fleschContent Readability5The Flesch reading ease of the text is 50 or higher: all 5 points. From 30 to 49: 3 points. Below 30: 0. English posts only: a post in another language passes this check once it has enough text.
passive_voiceContent Readability3A form of “to be” followed by a word ending in “ed” is found in 10% of the sentences or fewer: all 3 points. More than 10% and up to 20%: 2 points. More than 20%: 0. English posts only: a post in another language passes this check once it has enough text.
has_headingsContent Readability3The content has at least one heading from H2 to H6.
table_of_contentsContent Readability3The content has a table of contents: a Rank Forge table of contents block, three or more links to anchors on the same page, or the words “table of contents” in the text.
  • Nine checks need a focus keyword (kw_in_title, kw_in_description, kw_in_url, kw_in_intro, kw_in_content, kw_in_subheadings, kw_in_alt, kw_density, kw_title_start), 33 points together. With no focus keyword they earn nothing and one extra issue with the code focus_keyword is listed; the highest score is 67.
  • A keyword is found when the exact phrase is in the text or, for a keyword of several words, when every one of its words is.
  • short_paragraphs, sentence_length, flesch and passive_voice earn nothing before the post has 50 words and one real sentence.
  • title_power_word, flesch and passive_voice pass for a post that is not in English.
  • The label shown for each code in the overview of the most common issues comes from RANKFORGE_Scorer::issue_labels().

Custom Scoring Rules

You can modify the effective score or add custom checks by hooking into the analysis flow:

php
// Add a custom scoring rule that penalizes posts without a call-to-action
add_action( 'save_post', function ( $post_id, $post ) {
    if ( wp_is_post_revision( $post_id ) || $post->post_status !== 'publish' ) {
        return;
    }

    $content = $post->post_content;
    $has_cta = preg_match( '/<a[^>]*class="[^"]*cta[^"]*"/i', $content )
            || stripos( $content, 'sign up' ) !== false
            || stripos( $content, 'get started' ) !== false;

    // Store a flag for your custom reports
    update_post_meta( $post_id, '_custom_has_cta', $has_cta ? '1' : '' );
}, 25, 2 );
php
// Build a custom scoring overlay that extends Rank Forge scores
function my_custom_seo_score( $post_id ) {
    $cached = RANKFORGE_Analyzer::instance()->get_cached( $post_id );
    $base_score = $cached ? (int) $cached->score : 0;

    $penalties = 0;

    // Custom check: post must have at least one external link
    $content = get_post_field( 'post_content', $post_id );
    $site_url = home_url();
    preg_match_all( '/<a[^>]+href="([^"]+)"/i', $content, $matches );
    $has_external = false;
    foreach ( $matches[1] as $url ) {
        if ( strpos( $url, $site_url ) === false && strpos( $url, 'http' ) === 0 ) {
            $has_external = true;
            break;
        }
    }
    if ( ! $has_external ) {
        $penalties += 5;
    }

    return max( 0, $base_score - $penalties );
}

—

Forge AI Assistant Online

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

Just now
Powered by Forge AI · Browse docs