Filter on the_content ignores shortcodes

Unmodified do_shortcode is effectively a filter on the_content with priority 11. Your filter has priority 10. So it runs before the shortcode is evaluated and it won’t affect the post you put inside your page with a shortcode.

Now, you would think that the filter should also be triggered when the post inside the page is retrieved. This, however, is not necessarily true. The filter is only triggered when the content is retrieved with the_content, not with get_the_content.

Depending on what your modifications are, you may get the desired result if you set the priority on your filter to 99 or so, forcing the shortcode to be evaluated before the filter is applied.

Leave a Comment