Here is a helpful function for WordPress theme designers and developers. You can remove the Featured Image controls when creating a post, in case you have something custom that you want to use.
Simply place this action (the code snippet) in your functions.php
file to remove the featured image meta box.
PHPview code
add_action('do_meta_boxes', 'remove_image_box'); function remove_image_box() { $current_user = wp_get_current_user(); if ($current_user->user_level < 10){ remove_meta_box( 'postimagediv','post','side' ); } } |
This function includes a check for non-admin users. WordPress User Levels range from 0 to 10. Level 0 (zero) is the lowest possible 10 is the highest permission level – an admin user.
You can change the number 10 to any User Level or you can remove that part of the function altogether and just use the line remove_meta_box( 'postimagediv','post','side' );
to remove the box for everyone.
That’s it. Happy theme-ing!
0z2yi1