Is there a way to remove wptexturize only for a certain shortcode?

  • 1
    What is the shortcode in question? – Chip Bennett Mar 30 '11 at 3:13

There is a clue in wp-includes/formatting.php in the function wptexturize:

$default_no_texturize_shortcodes = array('code');
$no_texturize_shortcodes = '(' . implode('|',
    apply_filters('no_texturize_shortcodes', $default_no_texturize_shortcodes) ) . ')';

Try using this filter to add a shortcode to the array:

function my_no_tex( $shortcodes ) {
    $shortcodes[] = 'someshortcode';
    return $shortcodes;
add_filter( 'no_texturize_shortcodes', 'my_no_tex' );
| improve this answer | |

Shortcodes run after the wptexturize function, so they shouldn't get processed by it anyway.

wptexturize runs on the_content with priority 10. The do_shortcode function runs with priority 11.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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