// ===== CW: Fix blog post title tags (remove trailing separator, add site name) ===== // Titles were "Post Title -" — separator showing without site name after it. // Root cause: Yoast title template for posts has %%sep%% %%sitename%% but sitename // in wpseo_titles was empty. Fix: set it + remove stray trailing separator via filter. add_action( 'init', function () { if ( get_transient( 'cw_insights_title_fix_v1' ) ) return; $opt = get_option( 'wpseo_titles', array() ); // Ensure site name is set if ( empty( $opt['website_name'] ) ) { $opt['website_name'] = 'Codewave'; } // Ensure post title template includes site name if ( empty( $opt['title-post'] ) || strpos( $opt['title-post'], '%%sitename%%' ) === false ) { $opt['title-post'] = '%%title%% %%sep%% %%sitename%%'; } update_option( 'wpseo_titles', $opt ); set_transient( 'cw_insights_title_fix_v1', 1, 0 ); } ); // Belt-and-suspenders: strip any trailing " -" or " | " left by missing variable add_filter( 'wpseo_title', function ( $title ) { return preg_replace( '/s*[-|]+s*$/', '', $title ); } ); // ===== END CW: Fix blog post title tags ===== Software Engineer

Dhanush Shetty

107 posts
Dhanush Shetty is a Software Engineer at Codewave focused on building scalable, high-performance digital applications. He writes on software development, engineering architecture, and emerging technology trends—drawing on hands-on experience delivering cloud-native and mobile solutions for clients across industries.

Download The Master Guide For Building Delightful, Sticky Apps In 2025.

Build your app like a PRO. Nail everything from that first lightbulb moment to the first million.