• When I do a search on https://galleritheut.dk/wp/nyt/ (sorry, it’s in Danish!) the search results show up correctly (E.g. https://galleritheut.dk/wp/?s=Nicaragua. Both post and pages are shown.

    However, results present static paces as belonging to category ‘Sidste nyt’. It’s the only category presently in use for my blog posts. However, I don’t want static pages to be shown belonging to that category. They are in no category, really. I ticked those pages belonging to Parent: ‘Main page (no parent).’

    So, why do pages turn up under a category they don’t belong to?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Quick fix. Edit search.php and look for a reference to <?php the_category();?>. Amend this to:

    <?php if($post->post_type == 'post') :?>
    <?php the_category();?>
    <?php endif;?>

    This will stop any category information being displayed unless the result refers to a WP Post.

    Thread Starter pjoern

    (@pjoern)

    Thank you for the answer. That did it! Topic resolved.

    Anyway, finally I decided not to have category information shown at all on the search page.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘search post / pages results all in same category’ is closed to new replies.