Black Friday sale! Get 25% off WPSP Pro! Discount automatically applied at checkout.

[Support request] WPSP Shortcode not working in Category Descriptions

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support WPSP Shortcode not working in Category Descriptions

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #3974
    surfing
    Participant

    I am using WP Show Posts Pro and created several entries which I want to display in post category descriptions. I insert the short code within WP admin under the category description. However, when I view the category description on the fronted of my website all I see is the WP Show Posts short code, like this [wp_show_posts id=”123456″]. Any idea how to get the short code to work with category descriptions?

    #3976
    Tom
    Keymaster

    Hi there,

    WordPress doesn’t execute shortcodes within the category descriptions by default.

    You can try this to enable them: https://wordpress.stackexchange.com/questions/232411/how-get-a-shortcode-working-in-category-description

    #3977
    surfing
    Participant

    I put the code into the Snippets plugin and Lightweight Grids Columns and WP Show Posts shortcodes now work in category descriptions. Is this code stable? I mean the post from stackexchange is nearly two years old. Will I have to check on this each time a new WordPress update is released? Here is the code I inserted:

    add_filter( 'term_description', 'shortcode_unautop' );
    add_filter( 'term_description', 'do_shortcode' );
    remove_filter( 'pre_term_description', 'wp_filter_kses' );

    What does remove_filter… do? I commented out that line and it still seems to work out.

    #3979
    Tom
    Keymaster

    The code itself is good.

    The remove_filter line removes sanitization from the element, which means you can add scripts etc.. You can remove it safely.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.