Remove ShareThis Buttons From Post Excerpts

This is for the ShareThis WordPress plugin found at http://wordpress.org/extend/plugins/share-this/

In your theme’s functions.php file you’ll want to input the following code…

 remove_filter( 'get_the_excerpt', 'st_remove_st_add_link', 9 );
 remove_filter( 'the_excerpt', 'st_add_widget' );

This will remove the buttons from displaying on pages like the homepage, search results, category pages, etc etc. That is, assuming that your theme is coded to use the_excerpt() in template files.

If you only want to remove the buttons from say the homepage of your site, you could do something like…

if ( is_home() || is_front_page() ) {
remove_filter( 'get_the_excerpt', 'st_remove_st_add_link', 9 );
remove_filter( 'the_excerpt', 'st_add_widget' );
}

6 thoughts on “Remove ShareThis Buttons From Post Excerpts

  1. mo

    THIS WORKED! This has been doing my head in :) The instructions from the sharethis site is so dodge.

    If anyone is unconfident with PHP like I am, then just paste the code at the end of the doc before the closing ?> tag

    Reply
  2. Matthew Chambers

    Thanks!!!! I found that the ShareThis code was applying to over 15 excerpts on one page which happens to list our trainers. This was causing havoc with web visitors and the total load time.. very messy!

    Appreciate the code!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *