Bug Report: Infinite Scroll -> pre_get_posts
-
Problem:
The pre_get_posts is affecting the edit.php “is_main_query()” in the admin area. So whatever is set in the add_theme_support for posts_per_page modifies the is_main_query() everywhere including admin.
current:
/** * Let's overwrite the default post_per_page setting to always display a fixed amount. * * @param object $query * @uses self::archive_supports_infinity, self::get_settings * @return null */ function posts_per_page_query( $query ) { if ( self::archive_supports_infinity() && $query->is_main_query() ) $query->set( 'posts_per_page', self::get_settings()->posts_per_page ); }Needs to be:
/** * Let's overwrite the default post_per_page setting to always display a fixed amount. * * @param object $query * @uses self::archive_supports_infinity, self::get_settings * @return null */ function posts_per_page_query( $query ) { if (is_admin()) return $query; if ( self::archive_supports_infinity() && $query->is_main_query() && $query->is_home()) $query->set( 'posts_per_page', self::get_settings()->posts_per_page ); }Check to see if it’s filter is being run is_admin and return the normal $query if is. (alternatively) also check the $query->is_home() to make sure it’s only on the home page., could use is_front_page() there as well.
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
The topic ‘Bug Report: Infinite Scroll -> pre_get_posts’ is closed to new replies.