e Learning

Solution to WordPress Double Dash Problem

Question

I have a Problem. Whenever I add a double dash in to my content, WordPress automatically converts it into one long dash when display in the web browser. I suppose This is Because some kind of WordPress Auto Formatting.

Can anyone give me a solution to resolve this problem.

Answer

You’re Probably right, This must be because some kind of WordPress Auto Formatting. But there is a Solution and it is very simple.

Just Open the functions.php file of your current WordPress Theme and add the following Code.

add_filter( ‘the_content’ , ‘wp_double_dash’ , 99 );

function wp_double_dash( $text ) {

return str_replace( ‘–’, ‘–‘, $text );

}

Open the Web Browser again and see the result. Now on Double Dash should display as it is.