"Blog pages show at most" in setting not working

After the update to the new WordPress version, Blog pages show at most (Setting Reading) is not working. Even if I change the count as 5 there, the homepage shows 10 articles i. It is not changing even I change to any count.

For more information, I have two blogs that have the same theme and same WordPress version. One blog has 150 articles, and the other has 300 articles. 300+ article blogs faced this issue. Are there any changes that happen after publishing 300+ articles in WordPress? List 10 articles must show on the home screen as default? Any idea to solve this issue ?

I have found this code in the function.php is there anything to change

**
* Check if Latest Posts are being displayed on homepage and set 
  posts_per_page accordingly
*/
            function mts_home_posts_per_page( $query ) {
                global $mts_options;

                if ( ! $query-is_home() || ! $query-is_main_query() ) {
                    return;
                }

                $set_posts_per_page = 0;
                if ( ! empty( $mts_options['mts_featured_categories'] ) ) {
                    foreach ( $mts_options['mts_featured_categories'] as $section ) {
                        if ( 'latest' === $section['mts_featured_category'] ) {
                            $set_posts_per_page = $section['mts_featured_category_postsnum'];
                            break;
                        }
                    }
                }
                if ( ! empty( $set_posts_per_page ) ) {
                    $query-set( 'posts_per_page', $set_posts_per_page );
                }
            }
            add_action( 'pre_get_posts', 'mts_home_posts_per_page' );

            // Map images and categories in group field after demo content import.
            add_filter( 'mts_correct_single_import_option', 'mts_correct_homepage_sections_import', 10, 3 );

Topic home-url blog blog-page homepage posts Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.