hvs
hvs

Reputation: 536

get_tags wordpress function issue

Following code always outputs "Foo" regardless of whether the tag count is greater than 50 or not.

What is wrong with my syntax? Thanks.

$posttags = get_tags();
if ($posttags) {
                    foreach($posttags as $tag) {
                          if (intval($tag->count) > 50);{   
                            echo "Foo";

                          }

Upvotes: 0

Views: 90

Answers (1)

Gerald Schneider
Gerald Schneider

Reputation: 17797

You have a superfluous ; after your if

if (intval($tag->count) > 50);{
                             ^ 

Just remove it

if (intval($tag->count) > 50){   

The way it is now it basically says: "if count > 50 do nothing. Then do the echo "Foo" in the brackets."

Upvotes: 2

Related Questions