Skip to content

Instantly share code, notes, and snippets.

@wpweb101
Last active June 28, 2018 07:04
Show Gist options
  • Select an option

  • Save wpweb101/0bdbb114a0aa6f6f740f to your computer and use it in GitHub Desktop.

Select an option

Save wpweb101/0bdbb114a0aa6f6f740f to your computer and use it in GitHub Desktop.
Update vendor role title in woo pdf voucher
<?php // Do not add this if it's already added.
function woo_vou_change_vendor_role_name() {
//get vendor role
$vendor_role = get_role( WOO_VOU_VENDOR_ROLE );
if( !empty( $vendor_role ) ) { // if already added vendor role
// first remove vendor role
remove_role( WOO_VOU_VENDOR_ROLE );
// Now, add vendor role
$capabilities = array(
WOO_VOU_VENDOR_LEVEL => true, // true allows add vendor level
'read' => true
);
add_role( WOO_VOU_VENDOR_ROLE, __( 'Gift Voucher Vendor', 'woovoucher' ), $capabilities );
//get vendor role
$vendor_role = get_role( WOO_VOU_VENDOR_ROLE );
$vendor_role->add_cap( WOO_VOU_VENDOR_LEVEL );
}
}
add_action( 'init', 'woo_vou_change_vendor_role_name' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment