Shortcode errors if blank
-
So I’m curious if there’s any kind of conditional check we can do against fields, when using the shortcode.
I’ve used the following to output a “title” field (a select field) within my template file:
$title = do_shortcode(‘[wpmem_field title id=”‘.$user_id.'”]’);
However, this is throwing up the following error if the field is left as blank on the user:
Undefined index: in \plugins\wp-members\inc\class-wp-members-shortcodes.php on line 559
Obviously I still need to store the shortcode in my variable because some users have it and others don’t, but is there a way i can stop it from throwing up errors?
My default value is setup like so:
Please Select|,
As per documentation found at: https://rocketgeek.com/plugins/wp-members/docs/registration/choosing-fields/
The topic ‘Shortcode errors if blank’ is closed to new replies.