• Hello everyone,

    I am making a shortcode for my theme, but there is a problem.
    When I am making this shortcode, there comes automatically a
    tag after it. I solved this problem with this function:

    remove_filter( 'the_content', 'wpautop' );
    remove_filter( 'the_excerpt', 'wpautop' );
    
    function wpse_wpautop_nobr( $content ) {
        return wpautop( $content, false );
    }
    add_filter( 'the_content', 'wpse_wpautop_nobr' );
    add_filter( 'the_excerpt', 'wpse_wpautop_nobr' );

    But the problem is that this function does not work in Widgets, does anyone know how to make this function work in widgets?

    Greets,

    Joren

  • The topic ‘Function is not working in Widgets’ is closed to new replies.