WordPress Filters
Filters specific to WordPress content processing.
Content Processing
| Filter | Arguments | Description |
|---|---|---|
wpautop | br | Add paragraph tags |
wptexturize | — | Apply smart quotes and dashes |
shortcodes | — | Process shortcodes |
stripshortcodes | — | Remove shortcodes |
antispambot | hex_encoding | Obfuscate email address |
kses_post | — | Allow only safe HTML tags |
wpautop
Converts double line breaks to paragraph tags.
Arguments:
br— Convert single line breaks to<br>(default: true)
{{ post.content|wpautop }}
{{ text|wpautop(false) }} <!-- No <br> tags -->
wptexturize
Applies typographic replacements (smart quotes, em dashes, etc.).
{{ post.title|wptexturize }}
{{ "He said \"Hello\" -- it's nice"|wptexturize }}
shortcodes
Processes WordPress shortcodes in content.
{{ post.content|shortcodes }}
stripshortcodes
Removes WordPress shortcodes from content.
{{ post.content|stripshortcodes }}
antispambot
Obfuscates email addresses to prevent harvesting.
Arguments:
hex_encoding— Use hex encoding (default: 0)
{{ user.email|antispambot }}
{{ user.email|antispambot(1) }} <!-- Hex encoding -->
Common Patterns
Safe content output
{{ post.content|wpautop }}
Clean excerpt without shortcodes
{{ post.content|stripshortcodes|striptags|excerpt(25) }}
Protected email link
<a href="mailto:{{ user.email|antispambot }}">Contact</a>
Safe HTML from custom fields
{{ post.meta('html_field')|kses_post }}