• I have programmed a short-code plug-in that also needs the post wpautop disabled but I want the wpautop to be disabled ONLY is the short-code is actually used in the post.

    Can someone help me out with this,, I can’t seem to figure it out.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter delirium

    (@delirium)

    Anyone?

    I am sure someone with more experience can figure this out.

    Inside the loop, you can do this:

    //save the_content in temp var
        $tempcontent = get_the_content();
        //write here only the begining of the shortcode you need to check
        $tempseek = '[gallery';
    
        $temppos = strpos($tempcontent,$tempseek);
        if($temppos === false) {
          //Shortcode not found
        } else {
          //Shortcode FOUND, do what you need here
        }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to add_filter ONLY only if shortcode exists’ is closed to new replies.