apply_filters(); call it or don’t?
-
Greetings fellow theme coders,
After hunting around the forums, I discovered that some functions that return post or page content call apply_filters() so that any short tags are parsed and turned into HTML. But, other functions do not apply the filters so you have to call it yourself, like this:
$content = apply_filters('the_content', $content);
The WP docs has a cryptic description of what might happen with this behavior in the future (see below). So, I’m wondering what will happen to my theme if I’m calling apply_filters() but that function gets called automatically by WP in a future version. Any thoughts or suggestions?
Thanks
-NorthK
(From
https://codex.www.ads-software.com/Template_Tags/the_content#Alternative_Usage):“Please note! get_the_content will not have the following done to it and you are advised to add them until the core has been updated:
<?php $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); ?>
”
- The topic ‘apply_filters(); call it or don’t?’ is closed to new replies.