Support

Account

Home Forums ACF PRO Unable to query custom post type with specific category Reply To: Unable to query custom post type with specific category

  • Thanks, John.
    If you don’t mind, I am going to ask you a dumb question, as I am still learning.
    So, a lot of time, I will google for answers related to what I want.
    Below is the solution I found after you told me to use “get_terms”.
    Instead of showing only the selected categories for the post, it listed every single category I have created. Can you give me some clue why?

    $args = array(
      "hide_empty" => false,
      "taxonomy" => "project-category",
    );
    
    $terms = get_terms($args);
    foreach($terms as $term){
      echo $term->name.", ";
    }?>

    I hope I am not disturbing you, though.