• Hello everybody!

    I am using WP as a CMS and am having some trouble linking to category pages.
    I have a number of static Pages with slugs, let’s say “one”, “two”, “three”, etc. and Categories with the EXACT SAME slugs.
    What I want is that when in a Page with slug “four” there be a link to only one category, namely the category with slug “four”.

    I acomplished this with the following code, in sidebar.php:

    <?php //get Page's slug
    $post_id = get_post($post->ID);
    $slug = $post_id->post_name; ?>
    
    <ul><li><a href="<?php echo get_category_link(get_category_by_slug($slug)->term_id);?>">W&ouml;chentliches und Aktuelles Angebot</a></li></ul>

    You can see the site here. For example if you click go to the Page “Am Galgenberg” (slug “am-galgenberg”) the first link is “W?chentliches und Aktuelles Angebot”, which should lead to veranstaltungen/am-galgenberg/, the corresponding Category Page.

    This is actually working, BUT only when a registered user tries to access the category page! Why is this happening?
    I would appreciate any insight.

    Many thanks
    Alec

  • The topic ‘Link to specific category not working’ is closed to new replies.