Skip to content

Admin calendar: Avoid duplicate database query#522

Open
zosterops-lateralis wants to merge 1 commit into
stephenharris:developfrom
zosterops-lateralis:fix-admin-calendar-duplicate-query
Open

Admin calendar: Avoid duplicate database query#522
zosterops-lateralis wants to merge 1 commit into
stephenharris:developfrom
zosterops-lateralis:fix-admin-calendar-duplicate-query

Conversation

@zosterops-lateralis

Copy link
Copy Markdown

Hello,

It seems that the eventorganiser_admin_calendar() function (which handles the event-admin-cal Ajax action) always performs the same database query twice.

In fact, the constructor for WP_Query calls the query() method, which itself already calls the get_posts() method. Therefore, calling $query->get_posts() after contructing the $query object is unnecessary, as all the posts are already available in the $query object, and it will needlessly repeat the previous database query.

This PR simply proposes to remove the call to $query->get_posts().

Thanks!

Zosterops

The constructor for `WP_Query` already calls its `get_posts()` method.
There is no need to call it again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant