• What the title says.
    What’s the code for getting the category URL, inside a post?
    I can’t figure out..

Viewing 4 replies - 1 through 4 (of 4 total)
  • Type a word or two (my link) in the Visual Editor in a Post or Page. Using your mouse, highlight that text. When you do, you will notice that the chain icon in the Kitchen Sink is now not grayed out. Click it – a box will pop up…in that box you can link to existing content, in this case a category. After that add the Title Text (this is what is seen when a link created is hovered over)…done! Note, you may require permission for a blog admin if you are not one to do this.

    $cats = get_the_category();
    $cat_url = get_category_link( $cats[0]->term_id );

    this get the url of the (alphabetical) first post category.

    you can get the infos the individual functions by using web search with the keywords ‘WordPress Codex function_name()

    Actually, if you want to link to the category from inside the tinymce editor, like Seacoast Web Design described, you should install the plugin B09 Link to existing content.
    It provides you with a select for also linking to categories in the dialog “Or link to existing content”

    Thread Starter Disgeae

    (@disgeae)

    I was looking for the PHP code, I’ll try the code today alchymyth. Thanks.
    & what’s so hard about the ‘Get’ in the title.. I didn’t want to post a url inside a post.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Get category URL inside a post’ is closed to new replies.