themes - WordPress website loads more posts than expected

admin2025-05-31  0

Closed. This question is opinion-based. It is not currently accepting answers.

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 14 days ago.

Improve this question

On the homepage of a WordPress website the latest posts are visible. In the dashboard it's set to display 10 posts on the home page.

However, it loads 133 posts. Switching to the default theme didn't make any difference.

The version of WordPress is updated.

Where should we start debugging the problem?

Closed. This question is opinion-based. It is not currently accepting answers.

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 14 days ago.

Improve this question

On the homepage of a WordPress website the latest posts are visible. In the dashboard it's set to display 10 posts on the home page.

However, it loads 133 posts. Switching to the default theme didn't make any difference.

The version of WordPress is updated.

Where should we start debugging the problem?

Share Improve this question asked Jan 22, 2018 at 8:56 Ionică BizăuIonică Bizău 3213 gold badges5 silver badges20 bronze badges 5
  • Start by disabling all your plugins and see if the issue still exists – swissspidy Commented Jan 22, 2018 at 9:25
  • @swissspidy Thanks! Totally forgot about that technique – Ionică Bizău Commented Jan 22, 2018 at 9:34
  • @swissspidy Disabled all. It doesn't make any change. – Ionică Bizău Commented Jan 22, 2018 at 9:45
  • @DHL17 Sorry, what code? That's what I'm asking: I have no idea where to start debugging this. Changing the theme to default and disabling the plugins didn't make any change. – Ionică Bizău Commented Jan 22, 2018 at 11:09
  • ok. which theme u r using currently? – DHL17 Commented Jan 22, 2018 at 12:19
Add a comment  | 

1 Answer 1

Reset to default 2

The theme is most likely altering the main query via the pre_get_posts hook, chaning the posts_per_page argument to -1 for all posts, or another higher number.

You can search your theme folder for pre_get_posts to see all the times this hook is used.

A better solution would be to install the Query Monitor. With this plugin installed and active, you get a wealth of information about each page request.

To use it, login as admin and visit your homepage once the plugin is active. The admin bar will have a new options. Click the new option (looks like a bunch of numbers) and choose the "Hooks & Actions" section. From there, select "Pre" from the "Hook" dropdown and it will list all where the pre_get_posts hooks is being called.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748629691a313646.html

最新回复(0)