Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to get all roles in wordpress

/* get all role in wordpress in associative key = role(slug) => value(Role Display name) by joshiyogesh0333@gmail.com  */
function get_role_names() {

global $wp_roles;

if ( ! isset( $wp_roles ) )
    $wp_roles = new WP_Roles();

return $wp_roles->get_names();
}
Comment

get users by role wordpress

$getDealers = get_users( 
					array(
						'role'         => 'dealership',
						'orderby'      => 'nickname'
					)
				);
				
				if($getDealers) {			
					foreach($getDealers as $getDealer) {
						if($getDealer->ID == $new_user_data->dealer){
							update_user_meta($new_user_id, 'yews_data_dealership_name', $getDealer->nickname);
						}
					}
				}
Comment

wordpress get wp roles

function get_role_names() {

global $wp_roles;

if ( ! isset( $wp_roles ) )
    $wp_roles = new WP_Roles();

return $wp_roles->get_names();
}
Comment

PREVIOUS NEXT
Code Example
Php :: get current year php 
Php :: Carbon Format date with timezone in views Laravel 
Php :: Composer detected issues in your platform: Your Composer dependencies require a PHP version "= 8.0.2". 
Php :: fix excel file wrong language php 
Php :: Laravel Unable to migrate or Make Seeds 
Php :: laravel module remove 
Php :: laravel pass view with data 
Php :: artisan cache clear 
Php :: laravel create project command 
Php :: HTML Snippets not working in .php files 
Php :: Your Composer dependencies require the following PHP extensions to be installed: curl 
Php :: if any error in blade laravel 
Php :: php find key in array 
Php :: laravel select all except some columns 
Php :: implode php 
Php :: carbon finer 
Php :: wp revisions config 
Php :: laravel where condition on relationship 
Php :: remove all post in wordpress by query 
Php :: laravel bootstrap nav active 
Php :: php mkdir recursive 
Php :: wordpress global variable not working 
Php :: WP_DEBUG enable 
Php :: php subtract date from today 
Php :: wp enqueue style 
Php :: laravel migration with primary key 
Php :: laravel serve in another post 
Php :: check if number is multiple of 3 in php 
Php :: php compare two versions return true or false if version is big 
Php :: laravel get url path 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =