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?
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?
Three dots are converted to the typographically correct ellipsis … in wptexturize()
. You can disable it in many cases, see my plugin Disable Wptexturize.
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' );
?>
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.
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( '…', '...', $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.
Several possibilities, based on the use of a shortcode called '...' (Yes, that's a legal shortcode name.)
no_texturize_shortcodes
filter.<code>
tag (which is by default exempted from texturizing, so no filter is needed).<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).
...
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 Commented Mar 12, 2012 at 19:51U+2026
. It is also easier for automatic translation tools and screen readers if you use the special character. – fuxia ♦ Commented Mar 12, 2012 at 19:57