3

I'm doing some work for a new client (non-tech, their former tech person left). Their version of Wordpress is 4.3.2.

I have an admin account and I'm unable to edit existing posts. I can create new ones and edit those, but I'm unable to edit existing posts.

The edit links don't show and if I put in a url I construct myself like (/wp-admin/post.php?post=1375&action=edit)

I get this error message:

You are not allowed to edit this item.

I have full access to the filesystem, database, etc. how do I fix this issue so I can edit existing posts through the WordPress UX?

I see the user Role Editor plugin is installed.

I activated it and updated it. It shows that administrators have full permissions.

administrators have full permissions

  • Are you 100% sure your user has the Administrator role? If yes then this might be due to some plugin so the standard debug procedure follows: Disable all plugins and switch to a default theme. See if the issue persists. If it works now enable everything one by one and check when it breaks. – kraftner Jan 22 '16 at 12:54
  • Thanks @kraftner. I'm 99.9% sure :) In the user roles it shows as administrator and I've created another user as well (same result) thanks for the tip on disabling plugins (49 total 23 active, 26 inactive) – David Silva Smith Jan 22 '16 at 12:58
  • Wow with that many plugins your chances of one being the culprit are pretty good. Also you are not doing this on the live site but a local clone, right? :) – kraftner Jan 22 '16 at 13:00
  • lol, I wish there was a clone site. I haven't disabled them all yet I don't know enough about WP to know if that can cause issues. I think I'm going to try this (hack?) wordpress.stackexchange.com/questions/65418/… I'm trying to locate the right functions.php file (there are a lot) – David Silva Smith Jan 22 '16 at 13:07
  • Well I'm out then. Messing with admin rights and plugins on a live site is like conducting heart surgery with dirty hands and blindfolded. – kraftner Jan 22 '16 at 13:11
-1

I fixed this by editing /wp-includes/capabilities.php

The code was

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 );
}

and I changed it to

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 );
}
  • 9
    you shouldn't modify system WordPress files as next time you update the core, your changes will get overwritten – Stan May 11 '16 at 1:28
  • I second @Stan's comment. Editing Core files is a temporary solution that could be overwritten without you realising it if you have auto updates on. – Gary Nov 29 '16 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.