• Hi,

    In my functions.php I am using the following code to exclude a category in my entire site for non-logged-in users.

    if (!is_user_logged_in()) :
    	add_filter( 'pre_get_posts', 'exclude_category' );
    	function exclude_category( $query ) {
    		if ( is_feed() || is_home() || is_archive() || is_single() || is_search() || is_page() || is_paged() || is_author() || is_tax() || is_tag() || is_category() || is_singular() ) {
    			$query ->set( 'cat', '-5' );
    		}
    	}
    endif;

    When testing locally (MAMP) this works perfectly but as soon as I uploaded it to my site it totally messed up the post order.

    Any clues on what’s happening here? How to avoid this?

    Thanks a lot for any help!

  • The topic ‘exluding category messing up post order’ is closed to new replies.