Admin: Custom Query Returning Permissions Error

I think the problem is that by just appending ?deleteUser=XX you get an ‘illegal’ url, for example: http://localhost/wordpress/wp-admin/edit.php?post_type=type&page=mypage?deleteUser=xxx Instead, use WordPress’ add_query_arg: $url = $_SERVER[‘REQUEST_URI’]; $url = add_query_arg(‘test’,’val’,$url); which gives: http://localhost/wordpress/wp-admin/edit.php?post_type=type&page=mypage&deleteUser=xxx Personally, I wouldn’t use $_SERVER[‘REQUEST_URI’]; and instead hard-code the url of the page using admin_url. Also, see @Joshua comments on using the WordPress in-built … Read more

How to hide plugin options for editors via functions.php

This should be easiest way, just add the line to wp-config.php, this will disable plugin and theme editor, both. define(‘DISALLOW_FILE_EDIT’,true); If you want to add codes into theme’s function, the code should work for you. function ra_block_tp_edit( $caps, $cap ) { if($cap == ‘edit_plugins’ ) $caps[] = ‘do_not_allow’; return $caps; } add_filter( ‘map_meta_cap’, ‘ra_block_tp_edit’, 10, … Read more

Control Users listed in Users List on dashboard

WordPress doesn’t know which user created which, so first you need to store the creator’s data in the newly created user meta so you can so something like this: add_action( ‘user_register’, ‘Store_creator’ ); function Store_creator($user_id){ $creator = wp_get_current_user(); //only do this when none admin creates the user if ( $creator->roles[0] == ‘administrator’ ) return; update_user_meta($user_id,’_creator’,$creator->ID); … Read more