Skip to content

Instantly share code, notes, and snippets.

@wurwal
Last active May 20, 2020 21:26
Show Gist options
  • Save wurwal/2409a9d722e7c890d20034ca865ab312 to your computer and use it in GitHub Desktop.
Save wurwal/2409a9d722e7c890d20034ca865ab312 to your computer and use it in GitHub Desktop.
hide-dev-fields.php
<?php
function role_admin_body_class( $classes ) {
global $current_user;
foreach( $current_user->roles as $role )
$classes .= ' role-' . $role;
return trim( $classes );
}
add_filter( 'admin_body_class', 'role_admin_body_class' );
function wp_admin_field_css() {
echo '<style>
.role-editor [data-name="id"] {
display:none;
}
.role-editor [data-name="classes"] {
display:none;
}
.role-editor [data-name="block_container"] {
display:none;
}
.role-wpseo_manager [data-name="id"] {
display:none;
}
.role-wpseo_manager [data-name="classes"] {
display:none;
}
.role-wpseo_manager [data-name="block_container"] {
display:none;
}
.role_shop_manager [data-name="id"] {
display:none;
}
.role_shop_manager [data-name="classes"] {
display:none;
}
.role_shop_manager [data-name="block_container"] {
display:none;
}
</style>';
}
add_action('admin_head', 'wp_admin_field_css');
?>
@wurwal
Copy link
Author

wurwal commented May 19, 2020

hide rawww components acf dev fields from editors, seo managers and shop managers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment