WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Retrieve base url for tags (3 posts)

  1. EOZYVS
    Member
    Posted 2 years ago #

    Hi, I have been checking the codex and I don't seem to find a way to retrieve the tag base url.

    For example to access a tag i go to:

    http://mysite.com/tag/tagname/

    Where tag is your chosen prefix, defined in Admin -> Settings -> Permalinks

    I've tried with $wp_rewrite but it's not there, any suggestions?

  2. NateJacobs
    Member
    Posted 2 years ago #

    The tag and category base are stored in wp_options. You can use get_option( 'tag_base' ) to retrieve it.

  3. EOZYVS
    Member
    Posted 2 years ago #

    Thank you very much NateJacobs, that was precisely what i was looking for.

    I would like just to point out that something must be set as tag base in your Admin -> Settings -> Permalinks area, if you leave it empty get_options('tag_base') returns empty as well.

    Regards,

Topic Closed

This topic has been closed to new replies.

About this Topic