[wp-trac] [WordPress Trac] #26409: Non-Editors can create (non-hierarchical) terms even though they can't manage_terms
WordPress Trac
noreply at wordpress.org
Wed Oct 1 21:21:06 UTC 2014
#26409: Non-Editors can create (non-hierarchical) terms even though they can't
manage_terms
--------------------------+-----------------------------
Reporter: westonruter | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: Taxonomy | Version: 3.0
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------+-----------------------------
Comment (by danielbachhuber):
This provides an immediate fix, but doesn't solve the UX problem (users
still think they're adding a term until they've saved).
{{{
add_filter( 'pre_insert_term', function( $term ){
// Accommodate any async processes
if ( is_user_logged_in() && ! current_user_can(
'manage_categories' ) ) {
return new WP_Error( 'insert-term', "Sorry, you can't
create new terms" );
} else {
return $term;
}
});
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/26409#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list