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

Restrict the list of parent pages to only those which are created by current user

Classic editor You can use the filter hook page_attributes_dropdown_pages_args and set authors parameter in query arguments. add_filter( ‘page_attributes_dropdown_pages_args’, ‘se343814_own_post_as_post_parent’, 10, 2 ); function se343814_change_post_type_args( $dropdown_args, $post ) { // // for which types to apply the filter if ( $post->post_type != ‘page’ ) return $dropdown_args; $dropdown_args[‘authors’] = get_current_user_id(); return $dropdown_args; } Block editor In the … Read more

User restricted only show posts assigned to current user

You search certainly something like Members plugin. It allow you create a custom Role and You can make your site and its feed completely private if you want or just one or 2 posts. Its like you want. Or Manually, you can add new roles: function add_role() { add_role( ‘private_user’, “private user”,array( ‘is_able_to_read_private_page’=> true, ‘read’=> … Read more

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