WordPress Update meta_value by meta_key

// Clear Stock function clear_current_stock(){ // Declare the $wpdb var global $wpdb; // Run My SQL Query (My Query is setting the meta value for stock to zero) $wpdb->query(“UPDATE wp_postmeta SET meta_value = 0 WHERE meta_key = ‘_stock'”); // Check...

Check User Role ( if statement included )

<?php $user_id = get_current_user_id(); if (!empty($user_id)) { $user = wp_get_current_user(); $role = ( array ) $user->roles; // echo $role[0]; if ($role[0] == ‘free-client’ OR $role[0] == ‘administrator’) { //code here… } }...

WordPress create a shortcode

Inside your themes functions.php add the below snippet and fill out the placeholders. ############################################################################ ////////////////////////////////////// // This is your shortcode. You reference it like you see below...

Pin It on Pinterest