 <p>By default, WordPress filters the title and body of all posts through <a href="http://codex.wordpress.org/Function_Reference/wptexturize" rel="nofollow"><code>wptexturize</code></a>. Among other typographical niceties, this transforms various sequences of standard ASCII hyphens into appropriate dashes, e.g. " -- " is transformed into an <a href="https://en.wikipedia.org/wiki/Dash#Em_dash" rel="nofollow">em-dash</a>.</p> <p><code>wptexturize</code> is run by WordPress through the filters <a href="http://codex.wordpress.org/Plugin_API/Filter_Reference/the_title" rel="nofollow"><code>the_title</code></a> and <a href="http://codex.wordpress.org/Plugin_API/Filter_Reference/the_content" rel="nofollow"><code>the_content</code></a>. You can remove it -- code adapted from <a href="http://wordpress.stackexchange.com/questions/60379/how-to-prevent-automatic-conversion-of-dashes-to-ndash">this answer</a> -- by, for example:</p> <pre><code>remove_filter( 'the_title', 'wptexturize' ); </code></pre> <p>...in your theme's <code>functions.php</code>, say, or from within plugin code.</p> <p>However, I'd suggest that this will (a) make your titles not look as nice (you'll lose smart quotes, nice dashes, etc.), and (b) not be very future-proof. If something else starts filtering your titles -- a new plugin, a different theme -- then you'll be back with database mismatches.</p> <p>My approach would therefore be to adjust your existing code to use the post ID rather than the title. That's an integer, will never change, is never filtered, and will be faster to look up in the database (not just because it's an integer, but also because there's a unique index on it.) </p>