Remove Capabilities from WP admin for specific user role

You can add a condition on capabilities in order to exclude the admin from the unset action for example add_filter( ‘post_row_actions’, ‘remove_row_actions’, 10, 2 ); function remove_row_actions_staff( $actions, $post ){ //This line stops function execution if user has some admin capabilities if( current_user_can( ‘administrator’ ) ): return $actions; endif; if( $post->post_type() === ‘wiki-testimonials’ ) unset( … Read more

Redirection of users away from wp-admin (but not administrators)

Here’s how I do this: // if admin send them to the dashboard, otherwise leave them on the frontend add_action(‘wp_login’, ‘rt_login_redirect’, 10, 2); //use this action if you want them to be redirected only after login but leave the ability to to to the dashboard later (ie changing profile or pw). add_action( ‘admin_init’, ‘rt_login_redirect’ ); … Read more

Add, edit specific CPT with custom role

There’s no such hook named load-themes.php in WordPress. One of the hooks you can use to add custom capabilities is after_setup_theme. Also, there’s no need to use ‘themes.php’ == $pagenow && isset($_GET[‘activated’]) condition there. What are you trying to achieve this way? Try to use this code instead: add_action( ‘after_setup_theme’, function() { $role = get_role( … Read more

Change user role when post approve

You can attach code to change role when post status is changing from “pending” to “published” see documentation: http://codex.wordpress.org/Post_Status_Transitions Then, if user has role “contributor” you can change this to “author”: add_action( ‘pending_to_publish’. ‘my_function’, 10, 1 ); function my_function( $post ) { $wp_user_object = new WP_User( $post->post_author ); if ( in_array(‘contributor’, $wp_user_object->roles ) ) { … Read more

Change user role after bulk-import

From your question, I’m assuming these are users on a specific blog within a MultiSite installation, correct? In that case, do the following: Go to the blog for which you want to make these users administrators. Click on the “Users” button in the left-side admin sidebar This will present you with a display of about … Read more

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