Get DEFAULT category URL from place category taxonomy)

This topic contains 5 replies, has 3 voices, and was last updated by  Naveen Giri 4 years, 8 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #532438

    Brigitte
    Expired Member
    Post count: 235

    Hello!

    Here is more than 48 hours that I try to create a custom PHP function for the (single place) page… Indeed, I must be able to retrieve in a variable the URL of the default category of the current detail single page.

    I tried : get_the_category(), get_terms(), get_category_link()…. UNSUCCESSFULL 🙁

    I guess it’s easy, but… how please ?

    #532464

    Alex Rollin
    Moderator
    Post count: 27815

    I will ask the developers if they have some advice to share about that.

    #532571

    Brigitte
    Expired Member
    Post count: 235

    Thank you very much Alex for asking.

    #532620

    Naveen Giri
    Moderator
    Post count: 1559

    Please try this function.

    
    function get_primary_cat_url(){
    	global $gd_post;
    	$default_cat = absint($gd_post->default_category);
        return get_category_link( $default_cat );
    }
    

    Thanks

    #532754

    Brigitte
    Expired Member
    Post count: 235

    Thank you so much, works well! You rocks as usual 😉

    #532767

    Naveen Giri
    Moderator
    Post count: 1559

    Thanks for confirming, have a Great day.

Viewing 6 posts - 1 through 6 (of 6 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount