Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6006261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:30:49+00:00 2026-05-23T01:30:49+00:00

I am using the get_categories() function to manually create myself a nav menu. I

  • 0

I am using the get_categories() function to manually create myself a nav menu. I have a custom taxonomy I’m using called Category and I’m trying to return the link for it for my tags in the menu using the get_category_link() function.

foreach ($categories as $category) {
            if ($category->parent == 0) {   //Check to see it is a parent
                $output .= '<li>';
                $output .= '<a href="' . get_category_link($category->cat_ID) . '">' . $category->name . '</a>';  //display parent taxonomy category

             }
      }

But it always returns <a href="">. I can echo out the $category->cat_ID successfully so I know it is passing the ID into the function but I don’t know why it’s returning blank.

Am I missing something? Is it because these are custom taxonomies? They have slugs.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:30:50+00:00Added an answer on May 23, 2026 at 1:30 am

    You need something like this for custom taxonomies:

    $tax = 'cars';
      $cats = get_terms( $tax, '' );
      if ($cats) {
        foreach($cats as $cat) {
           $output .= "<li>";
    $output .= '<a href="' . esc_attr(get_term_link($cat, $tax)) . '" title="' . sprintf( __( "View all posts in %s" ), $cat->name ) . '" ' . '>' . $cat->name.'</a>';
    $output .= "</li>";
        }
      }
    

    Although you can easily add to the top of the script to get an array of all taxonomies to feed in if you wanted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I generate a menu from a database table using a function, and I've placed
I'm trying to create a very simple bar chart using the results of a
I have written a CGI script that creates an image dynamically using GET data.
I'm making call to Alfresco Webscripts which return JSON. I do this using GET
I'm using file_get_contents('mysourcefile.html') to load the contents of mysourcefile.html into mysql db. I have
I want to encode passwords for UNIX accounts using the crypt function. I'm using
I am using wordpress and I have an SQL statement (as below) to gather
I'm using WP Alchemy to create a meta box in a post that allows
I am using Ruby on Rails 3.0.7 and I am trying to set correctly
I'm havin troubles trying to get the results from this table using slugs. |

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.