Disable digg digg on custom post types

Digg digg by buffer is a great plugin for adding social links to posts but it doesn’t play very nice with custom post types.

Here is a way to hide the social buttons:

function radium_exclude_digg_digg() {

    if ( get_post_type() !== 'post' ) {
        remove_filter( 'the_excerpt', 'dd_hook_wp_content' );
        remove_filter( 'the_content', 'dd_hook_wp_content' );
    }

}
add_action('template_redirect', 'radium_exclude_digg_digg');

This will hide the buttons on ALL custom post types. To hide them on a specific post type, say one called ‘portfolio’, use:

function radium_exclude_from_portfolio_digg_digg() {

    if ( get_post_type() == 'portfolio' ) {
        remove_filter( 'the_excerpt', 'dd_hook_wp_content' );
        remove_filter( 'the_content', 'dd_hook_wp_content' );
    }

}
add_action('template_redirect', 'radium_exclude_from_portfolio_digg_digg');

Leave a Reply