• functions.php
    function my_home_category( $query ) {
    if ( $query->is_home() && $query->is_main_query() ) {
    $query->set( ‘cat’, ‘1’ );
    }
    }
    add_action( ‘pre_get_posts’, ‘my_home_category’ );

    I’m trying to set up to appear more than one category entretando still fails.
    I tried:
    $ query-> set (‘cat’, ‘1, 2 ‘);
    or
    $ query-> set (‘cat’, array (‘1 ‘, ‘2’)));

    but it still fails

The topic ‘Pre_get_posts’ is closed to new replies.