2 improv code formatting
source | link

It helps to write problems outdown.

After I haven't used pre_get_posts extensively, I focused too much on that area for the cause, but it was the ifif clause.

Changed to

if ( ! is_admin() && $query->is_main_query() && ! is_post_type_archive( 'cpt' ) ) {
    return $query;
} 
elseif ( ! is_admin() && $query->is_main_query() && is_post_type_archive( 'cpt' ) ) { // on is_post_type_archive( 'cpt' )
    $query->set( 'offset', '1' );
    return $query;
}
else {
    return $query;
}

Everything is working fine. I like pre_get_posts.

It helps to write problems out.

After I haven't used pre_get_posts extensively, I focused too much on that area for the cause, but it was the if clause.

Changed to

if ( ! is_admin() && $query->is_main_query() && ! is_post_type_archive( 'cpt' ) ) {
    return $query;
} 
elseif ( ! is_admin() && $query->is_main_query() && is_post_type_archive( 'cpt' ) ) { // on is_post_type_archive( 'cpt' )
    $query->set( 'offset', '1' );
    return $query;
}
else {
    return $query;
}

Everything is working fine. I like pre_get_posts.

It helps to write problems down.

After I haven't used pre_get_posts extensively, I focused too much on that area for the cause, but it was the if clause.

Changed to

if ( ! is_admin() && $query->is_main_query() && ! is_post_type_archive( 'cpt' ) ) {
    return $query;
} 
elseif ( ! is_admin() && $query->is_main_query() && is_post_type_archive( 'cpt' ) ) { // on is_post_type_archive( 'cpt' )
    $query->set( 'offset', '1' );
    return $query;
}
else {
    return $query;
}

Everything is working fine. I like pre_get_posts.

1
source | link

It helps to write problems out.

After I haven't used pre_get_posts extensively, I focused too much on that area for the cause, but it was the if clause.

Changed to

if ( ! is_admin() && $query->is_main_query() && ! is_post_type_archive( 'cpt' ) ) {
    return $query;
} 
elseif ( ! is_admin() && $query->is_main_query() && is_post_type_archive( 'cpt' ) ) { // on is_post_type_archive( 'cpt' )
    $query->set( 'offset', '1' );
    return $query;
}
else {
    return $query;
}

Everything is working fine. I like pre_get_posts.