filter applied after do_shortcode not showing results
-
I’m trying to apply a filter after the shortcode filters were applied. The function is running, but the output is not changing. This is only happening if the priority is lower than 11 which is when the do_shortcode filter is applied.
function myfilter_func($content) { echo "Debug: Function was called."; return "Filter was applied"; } add_filter('the_content', 'myfilter_func', 10);
This works and my content output is now
Filter was applied
However if I change the priority to 12 (after do_shortcode), i can see that the function is still being called (i. e. “Debug: Function was called.”) is displayed. But the_content output within the_loop is still the original content and not “Filter was applied”.
Who can help me? Thanks in advance
EDIT: currenlty I’m working around this problem by assigning this filter a priority of 10 or earlier. However, this way I have to run
$content = do_shortcode($content);
from inside my filter_func because I need the applied shortcode in there. This works, but I don’t think it’s pretty…
- The topic ‘filter applied after do_shortcode not showing results’ is closed to new replies.