Not able to access WP Admin, it says “Sorry, you are not allowed to access this page.”

I managed to solve this. Reason was that: The data about user roles, that’s set by default in a WordPress installation was completely missing in the db table wp_options under the wp_user_roles row. In my case it was this a:3:{s:14:”backwpup_admin”;a:2:{s:4:”name”;s:14:”BackWPup Admin”;s:12:”capabilities”;a:12:{s:4:”read”;b:1;s:8:”backwpup”;b:1;s:13:”backwpup_jobs”;b:1;s:18:”backwpup_jobs_edit”;b:1;s:19:”backwpup_jobs_start”;b:1;s:16:”backwpup_backups”;b:1;s:25:”backwpup_backups_download”;b:1;s:23:”backwpup_backups_delete”;b:1;s:13:”backwpup_logs”;b:1;s:20:”backwpup_logs_delete”;b:1;s:17:”backwpup_settings”;b:1;s:16:”backwpup_restore”;b:1;}}s:14:”backwpup_check”;a:2:{s:4:”name”;s:21:”BackWPup jobs checker”;s:12:”capabilities”;a:12:{s:4:”read”;b:1;s:8:”backwpup”;b:1;s:13:”backwpup_jobs”;b:1;s:18:”backwpup_jobs_edit”;b:0;s:19:”backwpup_jobs_start”;b:0;s:16:”backwpup_backups”;b:1;s:25:”backwpup_backups_download”;b:0;s:23:”backwpup_backups_delete”;b:0;s:13:”backwpup_logs”;b:1;s:20:”backwpup_logs_delete”;b:0;s:17:”backwpup_settings”;b:0;s:16:”backwpup_restore”;b:0;}}s:15:”backwpup_helper”;a:2:{s:4:”name”;s:23:”BackWPup jobs functions”;s:12:”capabilities”;a:12:{s:4:”read”;b:1;s:8:”backwpup”;b:1;s:13:”backwpup_jobs”;b:1;s:18:”backwpup_jobs_edit”;b:0;s:19:”backwpup_jobs_start”;b:1;s:16:”backwpup_backups”;b:1;s:25:”backwpup_backups_download”;b:1;s:23:”backwpup_backups_delete”;b:1;s:13:”backwpup_logs”;b:1;s:20:”backwpup_logs_delete”;b:1;s:17:”backwpup_settings”;b:0;s:16:”backwpup_restore”;b:0;}}} Whereas it should have Administrator at least somewhere. And this … Read more

unique url access control

You can just check if query string “u” exists, else redirect to your “you don’t have access” page. So something like this: if ( isset($_GET(‘u’)) ) { // SHOW YOUR CONTENT } else { header(‘Location: https://domain.com/no-access/’); die(); }

Admin Page access

As i can not allowed to comment, I post it here: Please Make sure when you are login to wp-admin, in usermeta table you have a role of ‘administration’ in $prefix->capabilities meta_key. Because this Message comes when you try login, that user has different role other than admin. Thank you.

if role is logged in then do something

Something like this would be more efficient. This is basic PHP by the way, not WP specific. function add_extra_item_to_nav_menu( $items, $args ) { $roles = [ ‘administrator’ => [ //Role – slug name ‘SCHOOL_NAME-A’, //url path – appended to the end ‘ADMIN’, // can be any name – appended to SHOP NOW button ], ‘ROLEABC’ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)