• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

category omission from front page causes admin search "anomaly"

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › category omission from front page causes admin search "anomaly"

This topic is: not resolved

Tagged: category, exclude, functions

  • This topic has 1 reply, 2 voices, and was last updated 11 years, 6 months ago by Summer.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • November 9, 2013 at 8:32 pm #71938
    SmockLady
    Member

    So here's what's going on and this is WELL beyond me and my minor bits of knowledge...
    I am using the Beautiful Pro (customized) theme, which I don't think matters much here but it might.
    Everything (mostly) is set the way I want it; I am trying to exclude a particular category from my home page. I have been able to do this successfully with a strange twist - it also excludes it from my admin posts list and I can't search for it either.

    Here's the code I am using:

    /**Customizing Home page feed **/
    function exclude_category( $query ) {
        if ( $query->is_page() && $query->is_main_query() ) {
            $query->set( 'cat', '-223,-288, -22' );
        }
    }
    add_action( 'pre_get_posts', 'exclude_category' );

    When I use it this way, the category posts show on my home page and are searchable in my admin posts.

    When I comment out a portion of it and use it this way:

    /**Customizing Home page feed **/
    function exclude_category( $query ) {
        if ( /*$query->is_page() &&*/ $query->is_main_query() ) {
            $query->set( 'cat', '-223,-288, -22' );
        }
    }
    add_action( 'pre_get_posts', 'exclude_category' );

    It removes the category posts from my home page as I desire, but they also get removed from my post list in the admin panel. What do I need to change?

    http://thefloodedfishbowl.com
    November 10, 2013 at 1:27 am #71986
    Summer
    Member

    Wouldn't you want to use is_home and is_front_page instead?


    WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
    Slice of SciFi | Writers, After Dark

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble