Brilliant! with Claude Code we can now master PHP, or any coding/scripting language.
Is RankMath in WordPress giving your site title “1” when Home page is set to Latest Posts? here is the fix. Thanks Claude, that took a couple minutes to fix.
The issue is that you’re using the wrong Rank Math filter hook. The rank_math/frontend/title filter receives the full title including separators and site name, and runs at a different point in the title generation process.
Here’s the corrected code:
add_filter( 'rank_math/frontend/title', 'force_custom_site_title', 999 );
function force_custom_site_title( $title ) {
return "EnviroLogics Renewable Energy News";
}

The key changes:
- Added priority
999– This ensures your filter runs last, after Rank Math’s own title generation - Simplified the function – Removed unnecessary assignment
If this still doesn’t work, try this alternative approach that targets the WordPress core title filter:
add_filter( 'pre_get_document_title', 'force_custom_site_title', 999 );
function force_custom_site_title( $title ) {
return "EnviroLogics Renewable Energy News";
}
Or if you want to override Rank Math completely and use WordPress’s default title system:
add_filter( 'rank_math/frontend/title', '__return_false', 999 );
add_filter( 'pre_get_document_title', 'force_custom_site_title', 999 );
function force_custom_site_title( $title ) {
return "EnviroLogics Renewable Energy News";
}
Important notes:
- Clear your cache (Rank Math cache, WordPress cache, and browser cache) after adding this code
- Make sure you’re adding this to your theme’s
functions.php - The high priority (999) ensures it runs after other filters
Try the first solution first, and if it doesn’t work, move to the alternatives. Let me know if you need further assistance!