• Resolved RoyBoy

    (@royboy)


    Hi
    my tag page isn’t working with wp_query()

    I decided to get the tag from the querystirng:
    $tag = basename($_SERVER['REQUEST_URI']);

    and then query by taxonomy:
    $args = array('post_type' => 'post','tax_query' => array(array('taxonomy' => 'tag','field' => 'slug','terms' => $tag)));

    Have searched the forums but can’t seem to find anything

    Any suggestions?

    Cheers

Viewing 1 replies (of 1 total)
  • Thread Starter RoyBoy

    (@royboy)

    Sorted!
    Just in case anyone runs into the same thing or has a better
    way of doing this

    $tag = basename($_SERVER['REQUEST_URI']);
    $wp_query->query('tag='.$tag);

    this will return all posts for that tag

Viewing 1 replies (of 1 total)
  • The topic ‘tag page’ is closed to new replies.