CPT Post Title Permalink: Replace “@” (or all special characters) with dash “-” instead of just removing
Just make sure your filter runs before the one that WordPress itself applies – add a priority of 9: add_filter( ‘sanitize_title’, function( $title ) { if ( FALSE !== strpos( $title, ‘@’ ) ) { $title = str_replace( ‘@’, ‘-‘, $title ); } return $title; }, 9 ); Usage: echo sanitize_title( ‘[email protected]’ ); Output: mytitle-example-org