0

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.

enter image description here

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 );
7
  • This would have something to do with your theme’s front page template. You will need to discuss this with your theme’s author. Sep 10 '21 at 4:53
  • @JacobPeattie I cannot contact him. Is there anything general thing I need to check with the theme homepage? If you give me an idea, i can check with that
    – Chadsmith
    Sep 10 '21 at 5:24
  • You would need to look at the code of the template used for the front page, and see what the code does. There's a chance that your theme simply doesn't support what you're trying to do. It's not possible to be certain without seeing the code of the theme, Sep 10 '21 at 16:55
  • @JacobPeattie I have updated with a code, is there anything i can do with it ?
    – Chadsmith
    Sep 11 '21 at 9:58
  • As a test, you could comment out the function mts_home_posts_per_page() or just comment out the call to add_action( 'pre_get_posts', 'mts_home_posts_per_page' ) to see if that changes the behavior you are seeing. I also suggest checking to see if there are any options with the theme you are using to control how many posts are presented at one time on the homepage of your site.
    – ScottM
    Sep 11 '21 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.