How to stop WordPress from changing ellipsis into a pre-composed triple-dot glyph?

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?

Related posts

Leave a Reply

5 comments

  1. 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' );
    ?>
    
  2. 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.

  3. 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.

  4. 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).