2

When I type an ellipsis composed of three separate dots ..., WordPress displays the pre-composed triple-dot glyph instead.

Is there any way to prevent WordPress from substitution the three dots?

  • Just out of curiosity: Where do you need three dots? – fuxia Mar 12 '12 at 3:42
  • Just out of personal preference... There are also several style guides that recommend ... instead of The ellipsis character did not exist before the advent of computers and in my humble opinion should not be used outside of a few specific use cases. – Philip Seyfi Mar 12 '12 at 19:51
  • How wide an ellipsis is depends on the font. Semantically it is one character, hence the separate Unicode code point U+2026. It is also easier for automatic translation tools and screen readers if you use the special character. – fuxia Mar 12 '12 at 19:57
2

Three dots are converted to the typographically correct ellipsis … in wptexturize(). You can disable it in many cases, see my plugin Disable Wptexturize.

2

That conversion - among others - is caused by the wptexturize() filter being applied to the_content().

The sledge-hammer approach to preventing wp_texturize() being applied to the_content() is simply to remove the filter, like so:

<?php
remove_filter( 'the_content', 'wptexturize' );
?>
0

Another option is to use the plugin wp-Typography, which can override WordPress's native character replacements. If you disable the changes you don't want in the plugin, they won't show up in the front-end anymore.

0

Instead of removing the entire wptexturize filter, I think a better approach to this issue is to let wptexturize() run and then undo the replaced ellipsis glyph with the three dots.

The filter is run at a priority of 11 so that it runs after wptexturize().

function wpse_45245_the_content( $content )
{
  return str_replace( '&#8230;', '...', $content );
}
add_filter( 'the_content', 'wpse_45245_the_content', 11 );

Note that this only replaces it in the_content filter, if you want it replaced in the_excerpt, the_title, etc., then you'll need to add those filters as well.

0

Several possibilities, based on the use of a shortcode called '...' (Yes, that's a legal shortcode name.)

  • Exempt the shortcode via the no_texturize_shortcodes filter.
  • Have the shortcode wrap the three period characters with a <code> tag (which is by default exempted from texturizing, so no filter is needed).
  • Similar to the above, but wrap it in a <span>, and use CSS to have it rendered in a font with an ellipsis character whose look you prefer (would need the filter this way).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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