Overview

Namespaces

  • None
  • VSP
    • Core
      • Abstracts
      • Interfaces
      • Traits
        • WC_Compatibility
    • Deprecation
    • Helper
    • Modules
      • Addons
      • Logger

Traits

  • Array_Helper
  • Framework
  • String_Helper
  • URL
  • WC_Helper
  • WP
  • Overview
  • Namespace
  • Class

Trait WP

Trait VSP_Framework_WP_Trait

Direct Known Users

VSP\Helper
Namespace: VSP\Core\Traits
Author: Varun Sridharan varunsridharan23@gmail.com
Located at includes/core/traits/class-wp.php
Methods summary
public static boolean
# is_user_role( null $role = null, null $current_role = null )

Checks if given user role is the same as current user role

Checks if given user role is the same as current user role

Parameters

$role
$current_role

Returns

boolean
public static mixed|string|WP_User
# current_user( boolean $user_role_only = true )

Gets current user information.

Gets current user information.

Parameters

$user_role_only
.

Returns

mixed|string|WP_User
public static integer
# current_user_id( )

Gets current wp user id.

Gets current wp user id.

Returns

integer
public static array
# filter_roles( array $required = array() )

This function will filter vsp_user_roles_as_options function and provide only the given user role slug values

This function will filter vsp_user_roles_as_options function and provide only the given user role slug values

Parameters

$required
.

Returns

array
public static array
# user_roles_lists( boolean $only_slug = false )

Returns only user roles as options or just a array of slug.

Returns only user roles as options or just a array of slug.

Parameters

$only_slug
.

Returns

array
public static mixed
# user_role_title( string|boolean $slug, string|boolean $default = false )

Returns User Role's title for the given user slug.

Returns User Role's title for the given user slug.

Parameters

$slug
$default

Returns

mixed
public static array
# get_user_roles( boolean $only_wp = false )

Parameters

$only_wp

Returns

array
public static string
# get_site_name( )

Gets the current WordPress site name.

Gets the current WordPress site name.

This is helpful for retrieving the actual site name instead of the network name on multisite installations.

Returns

string
API documentation generated by ApiGen