Skip to content

Instantly share code, notes, and snippets.

@wpweb101
Created March 4, 2020 11:47
Show Gist options
  • Select an option

  • Save wpweb101/58bc9c074eb2b6b0cead5529845dd9d8 to your computer and use it in GitHub Desktop.

Select an option

Save wpweb101/58bc9c074eb2b6b0cead5529845dd9d8 to your computer and use it in GitHub Desktop.
WooCommerce Pdf Vouchers - code to identify current login user role is voucher vendor
<?php
global $current_user, $woo_vou_vendor_role;
//Current user role
$user_roles = isset( $current_user->roles ) ? $current_user->roles : array();
$user_role = array_shift( $user_roles );
if( in_array( $user_role, $woo_vou_vendor_role ) ) { // Check current user is voucher vendor role
// perform your action
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment