Remove ShareDaddy meta box from Pages only

I’m trying to take away the option to have sharing options on ‘pages’ (but leave on posts).

So I have a function to make sure the sharing option is always no on pages

Read More
function page_disable_share($post_id)
{
if ( 'page' != get_post_type() )
    return;

    update_post_meta($post_id, "sharing_disabled", 1);
}
add_action('save_post', 'page_disable_share');

But I’d rather not have the meta box there at all, it might confuse the user if they tick it and it always unticks itself.

function page_remove_share()
{
    remove_meta_box( 'sharing_meta' , 'page' , 'normal' ); 
}
add_action('admin_menu' , 'page_remove_share');

Bu that’s not working. Maybe JetPack is getting hooked in after ‘admin_menu’? I tried other hooks (http://codex.wordpress.org/Plugin_API/Action_Reference) but none work. Any ideas?

Related posts

Leave a Reply

1 comment

  1. Use the add_meta_boxes action with a very low priority, so:

    function page_remove_share() {
        remove_meta_box( 'sharing_meta' , 'page' , 'advanced' ); 
    }
    add_action( 'add_meta_boxes', 'page_remove_share', 99 );
    

    I think that should work.