Error while setting role
You have to use just $current_role variable instead of $current_role[0], because call get_user_meta( $author->ID, ‘wp_capabilities’ ); will return you array with roles as keys. <?php add_action( ‘save_post’, ‘update_roles’ ); function update_roles( $post_id ) { if ( defined( ‘DOING_AUTOSAVE’ ) && DOING_AUTOSAVE ) return $post_id; // Get the author $author = wp_get_current_user(); // Set variables for … Read more