Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

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?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
    
It had so much potential, but unfortunately it doesn't work. –  deadlyhifi Sep 28 '11 at 12:57
    
I had a look how it was hooked in in the plugin itself. The answer is: remove_meta_box( 'sharing_meta', 'page', 'advanced' ); The only difference is that the context is 'advanced'. I can't answer my own question because my rep isn't high enough. –  deadlyhifi Sep 28 '11 at 13:06
    
Ok updated it :) –  Joost de Valk Sep 28 '11 at 13:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.