How to restrict an admin page, if the user is not superadmin?

To remove from the admin menu, you could use remove_menu_page(): add_action( ‘admin_menu’, function ( ) { if (is_super_admin()) return; remove_menu_page(); // or remove_submenu_page( … },99); If for some reason the page still exists, it’s just missing it’s menu link, you could check the get_current_screen() to see if the page is being viewed, and prevent access: … Read more

Allow Users to Modify Some Values of Assigned WordPress Pods [closed]

You can use map_meta_cap() to set more specific capabilities for your CPT. So instead of using the built-in edit_posts and edit_others_posts capabilities you would create edit_locations and edit_others_locations – thus allowing a new custom role to edit their own locations, but not edit_others_locations. You may find this related question helpful: Using Custom Meta Capabilities on … Read more

Change user role of a particular user at specific time

You can do something like this add_action(“after_switch_theme”, “schedule_cron_job”); // hook the schedule on theme switch or plugin activation based on the your usage also switch your theme after putting this on functions.php function schedule_cron_job(){ if (! wp_next_scheduled ( ‘import_into_db’ )) { wp_schedule_event(strtotime(’12:04:00′), ‘daily’, ‘import_into_db’); } } add_action(‘import_into_db’, ‘your_cron_job’); // You were hooking to wp function … Read more

Show menus to one admin username

function hide_menu() { global $current_user; $current_user = wp_get_current_user(); $user_name = $current_user->user_login; //check condition for the user means show menu for this user if(is_admin() && $user_name != ‘USERNAME’) { //your code here } } add_action(‘admin_head’, ‘hide_menu’);

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