troubleshooting Question

Wordpress - Adding an if/else Conditional Argument in a Post Template

Avatar of John H
John HFlag for United States of America asked on
4 Comments1 Solution173 ViewsLast Modified:
Hi All,

I have a Wordpress site that relies on posts having tags - its important to the categorization of the site.

I'd like to drop in a conditional argument in single.php such that if the post has no tags, that it echoes some content on the post (essentially, asking site visitors to suggest some tags in the comments section that i can later update the post with).

This code is not correct, but I hope it captures the essence of what I'm trying to do

	<?php if ( has_tag('none/null' ) { echo 'This page has no tags; please add tags in the comments section' ; } else { echo '' ; } ; ?>

Thanks in advance!!

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros