function wpsites_exclude_latest_post( $query ) { if ( $query->is_home() && $query->is_main_query() && !$query->is_paged() ) { $query->set( 'offset', '1' ); } } add_action( 'pre_get_posts', 'wpsites_exclude_latest_post', 1 );

This updated code will check if the query is not paged before excluding the latest post from the home page. This will prevent issues with pagination.

function wpsites_exclude_latest_post $query if $query-is_home && $query-is_main_query $query-set offset 1 ; add_action pre_get_posts wpsites_exclude_latest_post 1 ;修复分页错误

原文地址: http://www.cveoy.top/t/topic/hdZs 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录