Wordpress: Conditionally role change basis on post count
问题 Since almost 4-5 months I am trying to solve this issue where user role automatic change with certain number of post count. Say if x user have <= 10 post he/she is in contributor role if <=20 author role so on.. With help of you all people I could achieve this code. <?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