Remove OpenGraph settings meta box

I’m upgrading a multisite metwork and am really locking down a lot of functionality for the admins of their subsites.

Mostly to reduce confusions and to streamline each page.

I’m using this function to remove several meta boxes:

remove_meta_box( ‘postexcerpt’ , ‘post’ , ‘normal’ ); )

I am attempting to also remove the OpenGraph Settings meta box as well but not having any success.

Can you please let me know what I should be using to call the OpenGraph Settings meta box specifically? I’ve tried several names/ids, trying to guess what it could be but with no luck.

Basically just want to know what I would insert instead of ‘postexcerpt’

Thanks for any help you can give me!

  • Vladislav
    • Dead Eye Dev


    It’s important when the action handler that removes the metaboxes is run – it has to be after the default hooking action:

    function rogm_remove_post_metabox () {
    remove_meta_box('wdfb_opengraph_editor', 'post', 'side');
    add_action('add_meta_boxes', 'rogm_remove_post_metabox', 20);

    The above snippet will remove the box from the post editor only (also, the context value for the metabox is “side”:wink:. The box is by default bound to other custom post types as well, and to get rid of those boxes too, you might want to do something more verbose, e.g.:

    function rogm_remove_all_cpt_metabox () {
    $types = get_post_types(array('public'=>true), 'names');
    foreach ($types as $type) remove_meta_box('wdfb_opengraph_editor', $type, 'side');
    add_action('add_meta_boxes', 'rogm_remove_all_cpt_metabox', 20);

    Lastly, since the custom post types used by the plugin to add metabox to are exposed for filtering, you can get the same effect by using something like this:

    add_filter('wdfb-metabox-filter_registered_types', '__return_false');

    This will kill the metabox on all custom post types, just like the previous example, although in a (arguably) more elegant way,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.