WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Wordpress converts my theme options text with smart quotes.

I know that to remove problem from posts etc:

remove_filter('the_content', 'wptexturize');

remove_filter('the_excerpt', 'wptexturize');

remove_filter('comment_text', 'wptexturize');

But how to remove this effects when saving into Wordpress options api?

share|improve this question

WordPress does not automatically texturize options. If you are using add_option(), update_option(), and/or get_option() then it should "just work".


//Add an option to the database
update_option('my_test_option','This is an option. Isn\'t it "special"?');

//Returns string: This is an option. Isn't it "special"?
echo get_option('my_test_option');
share|improve this answer

Use a function to replace the smart quotes (following is based on code from this plugin), in functions.php:

function wpse89095_untexturize( $text ) {
    $char_codes   = array( '‘', '’', '“', '”', '′', '″' );
    $replacements = array( "'", "'", '"', '"', "'", '"' );
    return str_replace( $char_codes, $replacements, $text );

Then filter your option before it's saved to the database, in functions.php:

function wpse89095_untexturize_option( $newvalue, $oldvalue ){
    $newvalue = wpse89095_untexturize( $newvalue );
    return $newvalue;
add_filter( 'pre_update_option_{OPTION}', 'wpse89095_untexturize_option', 10, 2 );

NB: replace {OPTION} with the name of the option you'd like to filter.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.