Support » Fixing WordPress » PHP: Need help with if terms are empty

  • Hey there-
    Only a PHP newb here 🙂

    I need to write something that basically says “if both the courses taxonomy and the extracurriculars taxonomy are not used on this post, tell the student ‘you need to select some categories'”.

    This is what I’ve tried but does not work:

    <?php
    	if( get_the_terms($post->ID, 'courses_tax') && get_the_terms($post->ID, 'extracurriculars_tax') == FALSE){
    	?>
    		<p>YOU HAVE NO CATEGORIES ASSOCIATED WITH THIS ARTIFACT</p>
    	<?php
    	}
    ?>
  • The topic ‘PHP: Need help with if terms are empty’ is closed to new replies.