remove/hide pages from users backend

One way to achieve this is by looping through the parent pages and fetching their respective children pages ids. The resulting arrays can then be merged and used in the ‘post__not_in’ variable. add_filter( ‘parse_query’ , ‘exclude_pages_from_admin’ ); function exclude_pages_from_admin( $query ) { global $pagenow,$post_type; $pages = array(‘1′,’2′,’3’); foreach ( $pages as $parent_page ) { $args … Read more

admin_post action not usable if admin access denied to user

What about (1) current_screen? action hook, or a condition for (2) get_current_screen() in your conditional and then calling wp_redirect? Both give you a WP_Screen object which has several parameters, including a $parent_base property that can give broader inclusion if needed, too. Here’s the property list from the codex: $action Any action associated with the screen. … Read more

wordpress editor role remove all but ‘menus’ in appearance menu

by default the editor role should not have access to plugins nor appearance menu. But maybe this roles is already customised in your installation? here is a list of editor default capabilities via functions.php you can remove everything in the appearance menu like so: $role_object = get_role( ‘editor’ ); $role_object->remove_cap( ‘edit_theme_options’ ); to remove access … Read more

add_option_page capability behaving strange

admin_init is called after wp-admin/menu.php is included, so the access check has already been executed and the admin_menu action has fired by the time you execute test_options(). Remove the admin_init hook and call test_options() directly, or find another way of structuring your code so that the admin_menu hook is set up correctly. You might think … Read more

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