add_control( 'role', [ 'label' => __( 'Filter by Roles', 'frontend-admin' ), 'type' => Controls_Manager::SELECT2, 'options' => [ 'administrator' => __( 'Administrator', 'frontend-admin' ), 'editor' => __( 'Editor', 'frontend-admin' ), 'author' => __( 'Author', 'frontend-admin' ), 'contributor' => __( 'Contributor', 'frontend-admin' ), 'subscriber' => __( 'Subscriber', 'frontend-admin' ), ], 'multiple' => 1, 'default' => [], ] ); } protected function get_field_data( $field ) { $field = parent::get_field_data( $field ); $field['type'] = 'post_author'; $field['role'] = $this->get_settings( 'role' ); return $field; } /** * Get widget categories. * * Retrieve the list of categories the acf ele form widget belongs to. * * @since 1.0.0 * @access public * * @return array Widget categories. */ public function get_categories() { return array( 'frontend-admin-posts' ); } }