Web Hosting
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix Reply To: Locked out of Admin features

Discussion in 'Misc WordPress Requests' started by James Huff, Nov 18, 2017.

  1. James Huff

    Guest

    Reply To: Locked out of Admin features, by James Huff

    Ok, ask your hosting provider if WP-CLI is installed, and if so how to access it.

    If it is installed, and you can access it, run this command:

    wp role reset --all

    If you don’t have access to WP-CLI, first set the wp_user_roles to a:0:{} manually in the database.

    Then, access your server via SFTP or FTP, or a file manager in your hosting account’s control panel (consult your hosting provider’s documentation for specifics on these), and use a plain text editor to create a file at /wp-content/mu-plugins/ called reset-roles.php (if you don’t have a /mu-plugins/ directory at /wp-content/ create it first).

    Place only this inside that new reset-roles.php file:

    <?php
    // Reset roles for WP
    // First, set the wp_user_roles to "a:0:{}" manually (without the quotes), then run this as a mu-plugin
    // Remove mu-plugin afterwards

    require_once( ABSPATH . 'wp-admin/includes/schema.php' );
    populate_roles();

    Then, access your Dashboard, and the plugin will work your magic. It will do the same as the WP-CLI command above.

    Once it’s fixed, you can remove the plugin.

    If you’re unsure about doing any of this, relay these instructions to your hosting provider’s support, and they should be able to take care of it for you.

    Reply To: Locked out of Admin features
     
    #1

Share This Page

Web Hosting