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

    (@jdembowski)

    Forum Moderator and Brute Squad

    That plugin adds the button to the_content via add_filter.

    Try this: Create a new file called remove-pin-it.php and put it in the wp-content/plugins directory.

    In that file put these lines.

    <?php
    /*
    Plugin Name: Remove Pinterest Button from Pages
    */
    
    add_filter( 'the_content' , 'liz_remove_pin_it_button' , 30 );
    function liz_remove_pin_it_button( $content ) {
    if ( is_page() ) {
       remove_filter("the_content", "add_pin_it_button");
    }

    Go into your Dashboard and activate that plugin. It should check if the_content is inside a page and remove the Pinterest button from pages only.

    If something goes Really Wrong™ then just delete that new file remove-pin-it.php.

    Thread Starter LizStabbert

    (@lizstabbert)

    That gave me a blank page and the error
    “Parse error: syntax error, unexpected $end in /home/content/59/6174659/html/blog/wp-content/plugins/remove-pin-it.php on line 10” until I deleted the file 😮

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Whoops, did I screw that up, sorry. I’ll make up for that. 🙂

    I just installed the Pinterest plugin on my Crash Test Dummy blog and came up with this fix.

    <?php
    /*
    Plugin Name: Remove Pinterest Button from Pages
    */
    
    add_action( 'loop_start' , 'liz_remove_pin_it_button' );
    function liz_remove_pin_it_button() {
       if ( is_page() ) {
          remove_filter("the_content", "add_pin_it_button");
       }
    }

    Before I was trying to remove a filter from within the content that the filter was being applied. That won’t work.

    …Also I left off a closing } which caused that error…

    This new one worked for me and should work for you too. It only removes the button on pages and nothing else.

    Thread Starter LizStabbert

    (@lizstabbert)

    Rock on! Worked perfectly! Thanks so much!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Hiding plugins on pages’ is closed to new replies.