Last active
May 20, 2020 21:26
-
-
Save wurwal/2409a9d722e7c890d20034ca865ab312 to your computer and use it in GitHub Desktop.
hide-dev-fields.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hide rawww components acf dev fields from editors, seo managers and shop managers