disable wordpress smiley for a certain post/page

okie, i thought someone has figured it out by now. but when i asked on the wordpress board, i got no response. so i digged around and figured a hack for it.

i noticed sometimes esp. on some pages, the smiley conversion does a poor job and converts the wrong text into smilies. it really mars my content. personally i want to be able to just turn the smiley off for a certain post or page.

the best way i can think of to do it is via a hack.

open your wp-includes/functions-formatting.php file, try find the function (possibly line 576):
function convert_smilies($text) {

then under it, replace:
global $wp_smiliessearch, $wp_smiliesreplace; $output = ''; if (get_settings('use_smilies')) {

with:
global $wp_smiliessearch, $wp_smiliesreplace, $post; $output = ''; $smileykey = get_post_meta($post->ID, "disable_smiley", TRUE); if (get_settings('use_smilies') && $smileykey != 'true') {

that’s all i needed to do.

now next time you write a new post/post, simply create a custom field with the key disable_smiley and value true to disable smiley conversion for just that post/page. isn’t that neat? :)


2 Comments Leave a Comment

Bubbila [ Quote ]

sweet little tutorial…

February 1st, 2008 at 8:08 am
AzizLight [ Quote ]

Nice trick. Is there a way to completely disable the smilies? Maybe comment out the whole function block….?

August 11th, 2008 at 5:05 pm

Leave a Comment Name, email and comment are required.
Email will never be displayed.

Leave a Comment
  1. :biggrin: :blank: :blush: :bored: :confused: :cool: :down: :evil: :frown: :grin: :grr: :laidback: :left: :mad: :right: :sad: :secret: :shock: :smile: :stress: :tongue: :up: :wink: :yawn: :cute: :dead: :film: :floppy: :glasses: :grumpy: :headphones: :heart: :lightbulb: :ouch: :tv: :upsidedown: :vodka: :yell: :yuck: :yummy: