MetaBox.io on WordPress Dashboard's WordPress Events and News

Support General MetaBox.io on WordPress Dashboard's WordPress Events and NewsResolved

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #28558
    VlhhVlhh
    Participant

    Hi,

    I need a solution to completely remove MetaBox.io related news from the WordPress Dashboard for Non-Admin users.

    I saw one post about dismissing the news but I want to completely remove them for authors, editors etc who I'm not granting access to the plugin anyway.

    #28580
    Long NguyenLong Nguyen
    Moderator

    Hi,

    You can use this code to remove the WordPress Events and News widget

    add_action( 'wp_dashboard_setup', function() {
        remove_meta_box( 'dashboard_primary', 'dashboard', 'side' );
    } );

    and this code to remove Meta Box menu from dashboard menus

    add_action( 'admin_init', 'remove_menu_metabox' );
    
    function remove_menu_metabox() {
        if ( !current_user_can( 'administrator' ) ) { //change role or capability here
            remove_menu_page( 'meta-box' );
        }
    }

    Refer to these articles
    https://metabox.io/remove-unwanted-meta-boxes-wordpress/
    https://support.metabox.io/topic/hiding-meta-box-plugin-from-wordpress-dashboard-menu-for-non-admins/

    #28587
    VlhhVlhh
    Participant

    Hi Long,

    Thanks for your fast reply.

    You can use this code to remove the WordPress Events and News widget

    I'm not looking for a solution to completely remove the widget. Only the MetaBox.io related news from it.

    Would this be possible?

    #28596
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Currently, there is no filter to remove the news of Meta Box. You can use the admin CSS code to hide them.

    #dashboard_primary li.meta-box-news-item {
        display: none;
    }

    I will inform the development team to support removing Meta Box news in future updates.

    #28598
    VlhhVlhh
    Participant

    Hi Long,

    Thanks for the rapid workaround. Didn't pop into my mind I could use CSS for it. Looking forward for the option to remove the news for non admins.

    Thanks!

    #28618
    Long NguyenLong Nguyen
    Moderator

    Hi,

    The development team has added a new filter to remove the Meta Box news on this commit. It will be included in the next update.

    How to use: add this code to the file functions.php or use the plugin Code Snippets

    add_filter( 'rwmb_dismiss_dashboard_widget', function() {
        if ( !current_user_can( 'administrator' ) ) {
            return true;
        }
        return false;
    } );
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.