Wp_Helpers::wp_user_roles( string $label = null, string $option_code = 'WPROLE' )


Parameters Parameters

$label

(string) (Optional)

Default value: null

$option_code

(string) (Optional)

Default value: 'WPROLE'


Top ↑

Return Return

(mixed)


Source Source

File: src/integrations/wp/helpers/wp-helpers.php

	public function wp_user_roles( $label = null, $option_code = 'WPROLE' ) {
		if ( ! $this->load_options ) {


			return Automator()->helpers->recipe->build_default_options_array( $label, $option_code );
		}

		if ( ! $label ) {
			/* translators: WordPress role */
			$label = esc_attr__( 'Role', 'uncanny-automator' );
		}

		$roles = array();

		if ( Automator()->helpers->recipe->load_helpers ) {
			foreach ( wp_roles()->roles as $role_name => $role_info ) {
				$roles[ $role_name ] = $role_info['name'];
			}
		}
		$option = array(
			'option_code'              => $option_code,
			'label'                    => $label,
			'input_type'               => 'select',
			'required'                 => true,
			'options'                  => $roles,
			'custom_value_description' => esc_attr__( 'Role slug', 'uncanny-automator' ),
		);

		return apply_filters( 'uap_option_wp_user_roles', $option );
	}