• I’m trying to condition some ads based upon tags. I do it in several functions, so I want to define the array of tags I’m referencing just once.

    So I am doing this first:

    $noadtags = array('tag1','tag2','tag3');

    And the I have an IF statement that checks it. However, it is not working. Can someone see what is wrong with my PHP?

    if (!has_tag(array($noadtags))) {

    I’ve also tried it like this:

    if (!has_tag(array('$noadtags'))) {

    and like this:

    if (!has_tag(($noadtags))) {

    and this:

    if (!has_tag(('$noadtags'))) {

Viewing 1 replies (of 1 total)
  • DigitalSquid

    (@twelvefootsnowman)

    The 3rd example you posted should work fine. You’ve got a few too many brackets in the code but that shouldn’t stop it working:

    $noadtags = array('tag1','tag2','tag3');
    if(!has_tag($noadtags)){
    	// Do Something
    }
Viewing 1 replies (of 1 total)

The topic ‘has_tag with array conditional tag PHP question please’ is closed to new replies.