The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Get Category URL (4 posts)

  1. Lou Sparx
    Posted 5 years ago #

    Hi, If I'm on a category page.. example.com/category/2 and I want to place that url in a meta tag on the same page, how do I call that url?

    I've tried category_description() category_id() etc etc but none work or they show blank (because it's outside the loop).

    I've searched over 20 blogs for an answer to no avail.

    Basically, I need to put the current category url into a meta tag ON THAT SAME url.

    I appreciate any help.

  2. curlybracket
    Posted 5 years ago #

    I don't know if there is a function within WP that does this, but <?php echo $_SERVER['REQUEST_URI'] ?> should do what you want.

  3. Lou Sparx
    Posted 5 years ago #

    Alas that adds the url but as a hyperlink. I need the raw url output.

    Thanks anyway, Veganist, you've put me on the right track.


  4. curlybracket
    Posted 5 years ago #

    There are other options that could fit : http://php.net/manual/en/reserved.variables.server.php

Topic Closed

This topic has been closed to new replies.

About this Topic