Posted on February 28, 2020 by adminwordpress判断当前user $user = wp_get_current_user(); if ( in_array( 'staff', (array) $user->roles ) ) { //code here }