If you a look at the source you’ll see it’s because the sanitize_title
filter fires after remove_accents()
is called by sanitize_title()
.
It does however, pass the raw title as the second argument so you can perform any substitutions on the raw title, apply remove_accents()
and return it:
function wpsesanitize_title_extra( $title, $raw_title, $context ) {
$new_title = $raw_title;
$new_title = str_replace( '€', 'euro', $new_title );
$new_title = str_replace( '€', 'euro', $new_title );
$new_title = str_replace( '€', 'euro', $new_title );
if( 'save' == $context ){
$new_title = remove_accents( $new_title );
}
return $new_title;
}
add_filter( 'sanitize_title', 'wpsesanitize_title_extra', 5, 3 );