Divi WordPress Theme
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix Reply To: Excluding category form home page code not working?

Discussion in 'Misc WordPress Requests' started by scm22ri, Jan 5, 2018.

  1. scm22ri

    Guest

    Reply To: Excluding category form home page code not working?, by scm22ri

    Hi Guys,

    I’m adding my code into the functions.php page and it’s still not working.

    function twentyfifteen_setup() {

    function my_home_category( $query ) {
    if ( $query->is_home() && $query->is_main_query() ) {
    $query->set( 'cat', '-8' );
    }
    }
    add_action( 'pre_get_posts', 'my_home_category' );

    }

    Reply To: Excluding category form home page code not working?
     
    #1

Share This Page

Monarch Social Sharing Plugin