How to check an array of $curauth fields?
-
31-10-2019 - |
Question
How do I check an array of $curauth user data? I need to check to see if one or more $curauth fields have data, and if so, print some html. This throws an array error:
<?php if ( !empty( array ( $curauth->facebook, $curauth->linkedin, $curauth->twitter)))
{ echo 'echo me if any $curauth info exists for the fields in the array above'; } ?>
Update - this works:
<?php if (!empty ($curauth->facebook) || ($curauth->linkedin) || ($curauth->twitter))
{ echo 'echo me if any $curauth info exists for the fields in the array above'; } ?>
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange