According to the comments, your code only finds the smileys when they use ’
instead of '
. I used WordPress for a while, and I realized that it replaced some characters with others in the time of sending the posts, for the following reason: for ordinary users, replacing '
with its curved variation does not imply any difference in functionality, but leaves the posts easier to read by the fact that such symbols are generally used to mark quotations or irony. Microsoft Word does the same thing. Try typing some quotations using "
in Word so you'll see that it "corrects" them for curved quotes to a certain side depending on the context unless you disable the filter in the settings.
In WordPress, this filter is called wptexturize
and changes many characters, replacing them with their curved variants, such as '
(the source of your problem) and the quotation marks. The problem is that this filter is not applied at the time of writing the post, but when it is saved on the server, so it's really hard to know where the edit comes from.
To turn it off, open WordPress's functions.php
file, and before the last ?>
, add the following to disable substitution for all posts that will be created / edited in the future:
remove_filter ('category_description', 'wptexturize');
remove_filter ('list_cats', 'wptexturize');
remove_filter ('comment_author', 'wptexturize');
remove_filter ('comment_text', 'wptexturize');
remove_filter ('the_title', 'wptexturize');
remove_filter ('the_content', 'wptexturize');
remove_filter ('the_excerpt', 'wptexturize');
I should warn you, however, that this will not affect posts that have already been created, so you will have to re-edit all your posts and, if necessary, replace all ’
of smileys to '
again. This will make it easier to create more text replacement codes for smileys that use characters that wptexturize
modifies.