Search
 
SCRIPT & CODE EXAMPLE
 

PHP

wp wc php if not is single product page

function cm_redirect_users_by_role() {

    $current_user   = wp_get_current_user();
    $role_name      = $current_user->roles[0];

    if ( is_product() ){
        if ( $role_name !== 'customer' && $role_name !== 'shop_manager' && $role_name !== 'dc_vendor') {
            wp_redirect( 'https://www.mysite.fr/' );
        } // if
    }
} // cm_redirect_users_by_role
add_action( 'wp', 'cm_redirect_users_by_role' );
Comment

PREVIOUS NEXT
Code Example
Php :: php timezone paris 
Php :: symfony auto decode json request 
Php :: codeigniter number format function 
Php :: assocititive multi array compare php 
Php :: debugger in laravel 
Php :: Laravel Retrieving & Deleting An Item from session 
Php :: symfony append to file 
Php :: php date now 
Php :: create model and migration laravel 
Php :: cakephp group by count 
Php :: PHP code to read JSON string on server 
Php :: laravel withwhere 
Php :: laravel query when 
Php :: convertidos de 24 12 hr php 
Php :: laravel blade multiple can 
Php :: 0 
Php :: dropdown search php mysql 
Php :: Add current year on WordPress using Shortcode 
Php :: append variable to string php 
Php :: wp_delete_attachment unlink 
Php :: connexion à la base de donnée microsoftsqlserver avec php 
Php :: true not true acf 
Php :: php array sort 
Php :: laravel hiding attributes JSON 
Php :: create array of zeros php 
Php :: php two array difference merge recursive 
Php :: php monolog 
Php :: Declare A PHP Array 
Php :: Laravel all() and get() 
Php :: how to know who added product in magento 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =