• Hi all,

    I use a combination of plugins.

    – Advanced Custom Fields (ACF)
    – XYZ PHP snippets
    – WPbakery (pagebuilder)

    my issue is those Ptag cropping up everywhere, i’m losing my mind over it!!!

    so…

    step 1- i set up a ACF content/fields

    step 2- create my php snippet, like below as you can see NO P TAGS

    <div class=the-stakes-hero-outer><div style="color:<?php the_field('the_problemstakes_text_colour', 'option'); ?>" class="the-stakes-hero"><div class="os-titles the-stakes-title"><?php the_field('the_problemstakes_statementtitle', 'option'); ?></div><?php the_field('the_problemstakes_text', 'option'); ?></div><div class=the-stakes-image><?php the_field('the_stakes_image', 'option'); ?></div></div>

    step 3- insert my php snippet shortcode into my page via text block from Wpbakery, like below

    [xyz-ics snippet="The-Stakes-layout2"]

    now this is where those P TAGS start to appear!!!

    see screenshot here

    Once the shortcode is render on the page P TAGS get added WHY OH WHY OH WHY, why does this happen? how do i stop it?

    this issue had been driving mad for 5 years!!! this is my second post about it

    I have tried adding in, in a ton of different ways this code, IT DOES NOT WORK

    // Prevent WP from adding <p> tags on pages
    function disable_wp_auto_p( $content ) {
      if ( is_singular( 'page' ) ) {
        remove_filter( 'the_content', 'wpautop' );
        remove_filter( 'the_excerpt', 'wpautop' );
      }
      return $content;
    }
    add_filter( 'the_content', 'disable_wp_auto_p', 0 );
Viewing 1 replies (of 1 total)
  • I have tried adding in, in a ton of different ways this code, IT DOES NOT WORK

    I believe this will only work with WordPress’ native editor, not when you’re using a 3rd-party editor (WPBakery).

    The HTML markup in your screenshot are all generated by WPBakery, so that’s where you should be looking for a solution. But as this is a commercial plugin, there’s not much we can do to help you here, as we don’t have access to WPBakerly or any other commercial plugin or theme.

    As a test, you can insert your shortcode into a test page using WordPress’s native editor (aka Gutenberg) to see if any such extraneous P tags are generated.

    Good luck!

    • This reply was modified 3 years, 4 months ago by George Appiah.
Viewing 1 replies (of 1 total)
  • The topic ‘P tags’ is closed to new replies.