• 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

blog post not lists in admin area

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 › blog post not lists in admin area

This topic is: not resolved

Tagged: blog post categories

  • This topic has 1 reply, 1 voice, and was last updated 2 years, 1 month ago by SharonLandis.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • January 31, 2021 at 2:01 pm #502860
    SharonLandis
    Participant

    My site has two blogs / feed pages: blog and podcast

    The podcast page only lists post with category id 7 through a custom field query_args => cat=7.
    I couldn't get the blog page to exclude cat id 7 (query_args => cat=-7) using a custom field, instead I used php from another post on this forum:
    // Exclude categories from blog archive.
    add_action( 'pre_get_posts', 'exclude_categories_blog' );
    function exclude_categories_blog ( $query ) {
    if( $query->is_main_query() ) {
    $query->set( 'cat', '-7' );
    }
    }

    In the backend admin area, cat id 7 posts don't show up in the list of posts.

    How do I modify the above php to show cat 7 posts for the admin area?

    Thanks!

    http://slandisconsulting.com
    February 1, 2021 at 6:41 am #502867
    SharonLandis
    Participant

    updated php to
    if( !is_admin() && $query->is_main_query() )

    Works like a charm

  • 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

© 2023 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