• Whenever I try disabling WordPress’s auto p for shortcodes it always stays on. It randomly inserts <p> tags inside an anchor tag and starts to create unexpected results.

    I’ve tried moving the autop to after shortcodes using filters already and nothing yet.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    How are you attempting to disable wpautop?

    Are you putting this in your theme’s functions.php file?

    remove_filter( 'the_content', 'wpautop' );
    remove_filter( 'the_excerpt', 'wpautop' );

    http://codex.ww.wp.xz.cn/Function_Reference/wpautop#Disabling_the_filter

    Thread Starter lieutenantdan

    (@lieutenantdan)

    That works although I still want to keep the autop in posts and pages, just not in my shortcodes.

    This is one attempt,

    //move wpautop filter to AFTER shortcode is processed
    remove_filter( 'the_content', 'wpautop' );
    add_filter( 'the_content', 'wpautop' , 99);
    add_filter( 'the_content', 'shortcode_unautop',100 );

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘shortcode autop’ is closed to new replies.