The content scorer powers the “SEO” column in the posts list table, the metabox score indicator, and the analysis API.
Score Display Colors
| Score Range | Color | Hex |
|---|---|---|
| 80-100 (Good) | Green | #059669 |
| 50-79 (Medium) | Yellow | #D97706 |
| 0-49 (Bad) | Red | #DC2626 |
Rule-Based Scoring Algorithm (13+ Checks)
Score starts at 100 and deductions are applied:
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 SEO Forge scores
function my_custom_seo_score( $post_id ) {
$cached = SEOFORGE_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 );
}—