Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Important note - the code in the answer did break the frontend of the website - 'PHP Fatal error: Uncaught Error: Call to undefined function get_current_screen()'. To fix this I just had to move the 'is_admin()' check outside the 'get_current_screen()' function.
Yes, in my case there was no row for 'wp_capabilities' or 'wp_user_level' in wp_usermeta for the new admin user I had created. I created 2 new rows with the above & wp_user_level = 10
Perfect, thanks! One gotcha I encountered: "If you are defining a custom role, and adding capabilities to the role using add_role(), be aware that modifying the capabilities array and re-executing add_role() will not necessarily update the role with the new capabilities list. The add_role() function short-circuits if the role already exists in the database. The workaround in this case is to precede your add_role() call with a remove_role() call that targets the role you are adding." codex.wordpress.org/Function_Reference/…