Skip to content

Instantly share code, notes, and snippets.

@bentasm1
Created September 3, 2016 01:07
Show Gist options
  • Save bentasm1/8cd5706b6bc6194e0ea4f5e8f487e32d to your computer and use it in GitHub Desktop.
Save bentasm1/8cd5706b6bc6194e0ea4f5e8f487e32d to your computer and use it in GitHub Desktop.
Warn vendors if they dont have some custom field set
/* This will warn a vendor if some magical meta key isnt set. Change it to the one you need in the code below: */
// Get the users meta key we want to check.
$the_meta_key = get_user_meta( get_current_user_id(), 'CHANGEME', true ); // CHANGE CHANGEME TO THE META KEY NAME YOU WANT TO CHECK.
// DEBUG STUFF. UNCOMMENT TO CHECK STUFF.
// echo '<pre>THE META KEY IS: ' . $the_meta_key . '</pre>';
// Check if meta key is set
if (!isset($the_meta_key)) {
echo '<h3>Oh no! Your custom meta key isnt set! Your admin should change this message to be useful!';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment