Wordpress - Sorry, you are not allowed to edit this item
If you're trying to edit Categories/Custom taxonomies and you get this error, you should be doing the following.
Check the
wp_term_taxonomy
table for Term IDs that are associated with more than one Taxonomy ID. These records are the root cause for the error. The following query should help you find that.SELECT term_id, COUNT(term_id) FROM wp_term_taxonomy GROUP BY term_id HAVING COUNT(term_id) > 1;
Check for the
taxonomy
column in thewp_term_taxonomy
table that you would like to retain and delete the othertaxonomy
record. Before deleting refer #3.You should also be deleting records from
wp_term_relationships
table for the correspondingterm_taxonomy_id
that you're deleting from thewp_term_taxonomy
table.
Tip:Back up your database before executing any DELETE queries on your database.
Deactivate All your plugin and Activate them one by one it will help to find the culprit. if you are not able to get into the dashboard use FTP and rename plugins directory.
Temporary Fix - Recommended for staging only
i've found a temporary fix is to edit wp-includes/capabilities.php
Replace this code
function current_user_can( $capability ) { $current_user = wp_get_current_user(); if ( empty( $current_user ) ) return false; $args = array_slice( func_get_args(), 1 ); $args = array_merge( array( $capability ), $args ); return call_user_func_array( array( $current_user, 'has_cap' ), $args );}
With This
function current_user_can( $capability ) { $current_user = wp_get_current_user(); if ( empty( $current_user ) ) return false; if (is_admin()) return true; $args = array_slice( func_get_args(), 1 ); $args = array_merge( array( $capability ), $args ); return call_user_func_array( array( $current_user, 'has_cap' ), $args );}
That's just a temporary fix. If it works, you will still have to find appropriate solution as capabilities.php
is core file & any update will override your code.