I am using User Role Editor to specify customized user roles. I am also using Advanced Custom Fields plugin.

I would like to be able to hide Advanced Custom Fields from showing up for certain users; however, the only way to do this in User Role Editor is to uncheck "Manage Options" box. The problem with doing this is it removes other plugins from showing up which I in fact would like to show up for those users.

Is there a bit of manual code I can place in my functions.php that will remove only Advanced Custom Fields for certain user roles? Just this plugin.

1 Answer 1


The admin_menu action will hide the ACF menu, in this example for not-admins.

And admin_head will block the access if the URL is accessed directly.
E.g.: http://example.com/wp-admin/edit.php?post_type=acf and http://example.com/wp-admin/edit.php?post_type=acf&page=acf-settings

add_action( 'admin_menu', 'wpse_59032_remove_acf_menu', 9999 );
add_action( 'admin_head-edit.php', 'wpse_59032_block_acf_screens' );
add_action( 'admin_head-custom-fields_page_acf-settings', 'wpse_59032_block_acf_screens' );

function wpse_59032_remove_acf_menu() 
    /* if not our allowed users, hide menu */
    if ( !current_user_can('delete_plugins') ) {

function wpse_59032_block_acf_screens()
    global $current_screen;

    /* not our screen, do nothing */
    if( 'edit-acf' != $current_screen->id && 'custom-fields_page_acf-settings' != $current_screen->id )

    /* if not our allowed users, block access */
    if ( !current_user_can('delete_plugins') ) {


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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