I'm using Timber on a WordPress site but am having an issue with shortcode content appearing on the homepage as html/text. I'm using {{ post_content|exceprt(30) }} to display the post content but this causes shortcodes to be displayed.

I'd prefer not to display any shortcode content at all on this page (either rendered or as html/text), if possible.

Is there any way to filter out shortcodes using Timber?

1 Answer 1


try adding the pipe stripshortcodes {{ post_content|exceprt(30)|stripshortcodes }}

  • thanks @McKean, that worked great. Thought I had searched everywhere in the docs - obviously not.
    – ShayH
    Jul 3, 2017 at 20:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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