Support » Fixing WordPress » Get a posts category

  • Resolved romanczar



    I just can’t find a solution or proper hint online… How can I find out a post’s category slug?

    – Each post has 1 and only 1 category
    – I have pags which have the same slug as he category
    – I need to get the matching page ID via the page slug, which equals the category slug… crazy, hm?

    So the idea would be something like

    $cat_slug = get_posts_cat_slug($post->ID);
    $page_slug = $cat_slug;
    $page_ID = get_page_ID_by_slug($page_slug);
    custom second loop with $page_ID

    Can anyone help me alittle bit, please?

    Kind regards

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get a posts category’ is closed to new replies.