Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

When I write my site's title, description, posts, pages, or a taxonomy description, small dashes - are turned into longer, uglier ones –.

Is there some way to stop this from happening? Can I put some sort of function in my functions.php? Any ideas?

share|improve this question

2 Answers 2

- is a hyphen or minus, not a dash. Converting it to an en dash is actually the correct thing to do from a typographical standpoint.

http://en.wikipedia.org/wiki/Hyphen-minus

Typography is one of those deep-read kind of ideas, but the bottom line is that you think the hyphen minus is the correct character to use because of limitations in early typewriters. The correct character to use in most all the instances where you type the minus sign, from a typesetting and printing (and now, web) point of view is actually the en dash.

But if you really want to use incorrect typography, then bungeshea's approach above will work, or you can remove the wptexturize filter from the_content. The wptexturize function corrects this common typographical mistake, as well as fixing quotes, apostrophes, primes and double primes, dashes, whole bunch of other stuff. Basically it transforms what you type into the correct typography for it.

share|improve this answer
    
I agree - it's better to use an en dash then a minus, same as using an ellipsis is better then three periods. –  bungeshea Dec 10 '12 at 2:34
    
To remove the wptexturize filter, use this code: remove_filter( 'the_content', 'wptexturize' ); –  bungeshea Dec 10 '12 at 2:35
    
Also see: markjaquith.wordpress.com/2012/06/25/… –  bungeshea Dec 11 '12 at 3:57

The transformation happens in the wptexturize() function. It turns a regular dash (-) into an en dash (–). The function translates the en dash using the _x() function, which in turn uses the gettext_with_context filter. We can hook into this filter to return a regular dash instead of an en dash:

add_filter( 'gettext_with_context', 'wpse_75445_use_pretty_dash', 10, 2 );

function wpse_75445_use_pretty_dash( $text, $context ) {
    if ( $text == '–' && $context == 'en dash' )
        $text = '-'
    return $text;
}

However, as explained in Otto's answer, it's typographically correct to use an en dash instead of a hyphen/minus sign. But it is your site, so whatever works for you and your users.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.