How to Disable WordPress Embeds Using ...
Learn how to disable WordPress embeds using PHP code with this simple snippet.
...

WPCodeBox
695
Empower site administrators to automatically check “Virtual” and “Downloadable” product options in WooCommerce based on user roles, streamlining product setup.
add_filter( 'product_type_options', 'autocheck_virtual_downloadable');
function autocheck_virtual_downloadable( $args ){
//Set Your targeted user role(s) here
$targeted_user_roles = array( 'administrator', 'vendor' );
// Get the current user object
$user = wp_get_current_user();
// Get the roles of current user
$user_roles = $user->roles;
if ( array_intersect( $targeted_user_roles, $user_roles ) ){
// Auto-Check Virtual and Downloadable Checkboxes
$args['virtual'] ['default'] = "yes";
$args['downloadable']['default'] = "yes";
return $args;
}
}





