WordPress.org

Ready to get started?Download WordPress

Forums

Jetpack by WordPress.com
[resolved] removing post_submitbox_misc_actions action (5 posts)

  1. Kirk Wight
    Member
    Posted 1 year ago #

    Hello,

    I need to remove the Publicize section from the Publish meta box on the Post Edit page. It appears its being added by hooking on to post_submitbox_misc_actions; but it's being done with an array and object by reference, and I just can't figure out what the magic is to remove it by remove_action, eg. remove_action( 'post_submitbox_misc_actions', $publicize_ui->post_page_metabox );

    Any ideas?

    http://wordpress.org/extend/plugins/jetpack/

  2. designsimply
    Member
    Plugin Contributor

    Posted 1 year ago #

    So you want to keep Publicize on but disable the per post settings for it? Just out of curiosity, why would you want to do that? I seems like an important part of how Publicize works to me.

  3. Kirk Wight
    Member
    Posted 1 year ago #

    I'm trying to remove Publicize from the submit box only for one custom role, while keeping it for regular users.

    We have members of our organization that are allowed to edit their own five locked-down posts (that make up a detailed profile). THe whole Publicize thing is just causing confusion, and since we're not supporting it with our members in any way, I just want to remove it (preferably through post_submitbox_misc_actions).

    Any ideas?

  4. Beau Lebens
    Member
    Plugin Author

    Posted 1 year ago #

    Adding the following into my theme's functions.php seems to do the trick (since Publicize actually creates a global that you can use to reference UI elements):

    add_action( 'admin_head-post-new.php', function() {
            global $publicize_ui;
            remove_action( 'post_submitbox_misc_actions', array( $publicize_ui, 'post_page_metabox' ) );
    } );

    Note this is using an enclosure, but you can do the same creating a separate function.

  5. Kirk Wight
    Member
    Posted 1 year ago #

    Weird; I was sure I tried that combination with globalizing $publicize_ui, but apparently not :)

    I just hooked off of admin_head-post.php instead so that it kicks in for the edit page, and I'm good. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic