Tag Info

Hot answers tagged


When registering your taxonomy you can pass an argument called capabilities. Simply passing capabiities that only admins and editors have. $args = array( 'capabilities' => array( 'manage_options', 'edit_posts' ) ); register_taxonomy( 'foobar', 'post', $args ); https://codex.wordpress.org/Roles_and_Capabilities#Editor


Shorter solution based on answer http://wordpress.stackexchange.com/a/49200/83038. NOTE: Available since WordPress 3.7.0. function fix_count_orders( $counts, $type ) { global $wpdb; $query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s"; $query .= $wpdb->prepare( " AND post_author = %d", ...


You want to use the admin_init hook: add_action( 'admin_init' , 'taxonomy_for_admin_and_editor_only' );


I never played with roles before so this was a fun learning experience. I'm leaving this because I've spent a lot of time researching this area and this might help the next person. I know my question is in regards to the taxonomy but I was confused with the issue so I wanted to test from a CPT level. The correct hook was admin_init however it was still ...


I was hunting for a way to do this, and no-one seems to mention the wp_editor_settings filter. This worked for me: function my_editor_settings($settings) { $settings['quicktags'] = false; return $settings; } add_filter('wp_editor_settings', 'my_editor_settings');


Just in case anyone trips over this...here's how you remove "search" and some examples of other things you can remove from the admin bar: public function remove_admin_menu_bar_items ($wp_toolbar) { $wp_toolbar->remove_node( 'my-sites' ); $wp_toolbar->remove_node( 'wp-logo' ); $wp_toolbar->remove_node( 'new-content' ); ...


The following worked for me in functions.php /** * [remove_meta_boxes remove the resource type standard meta box from the side sortables in the resource post edit screen * @return [type] [description] */ function remove_meta_boxes(){ remove_meta_box( 'resourcetypesdiv', 'resource','side' ); } add_action( 'admin_menu', __NAMESPACE__ . ...

Only top voted, non community-wiki answers of a minimum length are eligible