Posts Tagged ‘Wordpress’
How to avoid that wordpress replaces — with – in HTML
If you run a blog that covers topics from Linux / Unix like we here at FAQforge and you include Linux shell commands in a wordpress post, you might have noticed that Wordpress replaces the char combination “–” with – in the HTML sources. But the replacement – is displayed by the browser as “-” and not “–”. So if someone copys your shell command examples to execute them, they will not work. To fix this behaviour, edit the file wp-includes/formatting.php in wordpress and replace the lines 55 and 56:
$static_characters = array_merge(array(‘—’, ‘ — ‘, ‘–’, ‘ – ‘, ‘xn–’, ‘…’, ‘“’, ‘\’s’, ‘\’\”, ‘ ™’), $cockney);
$static_replacements = array_merge(array(‘—’, ‘ — ‘, ‘–’, ‘ – ‘, ‘xn--’, ‘…’, $opening_quote, ‘’s’, $closing_quote, ‘ ™’), $cockneyreplace);
with:
$static_characters = array_merge(array(‘—’, ‘ — ‘, ‘xn–’, ‘…’, ‘“’, ‘\’s’, ‘\’\”, ‘ ™’), $cockney);
$static_replacements = array_merge(array(‘—’, ‘ — ‘, ‘xn--’, ‘…’, $opening_quote, ‘’s’, $closing_quote, ‘ ™’), $cockneyreplace);