WordPress.org

Make WordPress Core

Opened 3 months ago

Last modified 10 days ago

#51660 reviewing enhancement

Adding a filter to WP_List_Table::months_dropdown() to allow overriding the list of months displayed

Reported by: geoffguillain Owned by: SergeyBiryukov
Milestone: 5.7 Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch needs-dev-note
Focuses: performance Cc:

Description

In WP_List_Table::months_dropdown(), a query is run to determine the months that have post items.

This query can be expensive for large posts/custom posts listing, so it may be desirable for sites to override this behavior. I am monitoring around 500ms for 500k+ posts.

The filter available, disable_months_dropdown, only allows removing the dropdown not overriding the query.

A similar filter (media_library_months_with_files) has been set previously for the media library. I was expecting a similar behavior for the month dropdown on post listing pages

Change History (10)

This ticket was mentioned in PR #767 on WordPress/wordpress-develop by geoffguillain.


7 weeks ago

  • Keywords has-patch added

In WP_List_Table::months_dropdown(), a query is run to determine the months that have post items.
This query can be expensive for large posts/custom posts listing, so it may be desirable for sites to override this behavior. I am monitoring around 500ms for 500k+ posts.
The filter available, disable_months_dropdown, only allows removing the dropdown not overriding the query.

This modification will enable to override the query. A similar filter (media_library_months_with_files) has been set previously for the media library.

Trac ticket: https://core.trac.wordpress.org/ticket/51660

#2 @prbot
7 weeks ago

github-actions[bot] commented on PR #767:

Hi @geoffguillain! 👋

Thank you for your contribution to WordPress! 💖

It looks like this is your first pull request to wordpress-develop. Here are a few things to be aware of that may help you out!

No one monitors this repository for new pull requests. Pull requests must be attached to a Trac ticket to be considered for inclusion in WordPress Core. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description.

Pull requests are never merged on GitHub. The WordPress codebase continues to be managed through the SVN repository that this GitHub repository mirrors. Please feel free to open pull requests to work on any contribution you are making.

More information about how GitHub pull requests can be used to contribute to WordPress can be found in this blog post.

Please include automated tests. Including tests in your pull request is one way to help your patch be considered faster. To learn about WordPress' test suites, visit the Automated Testing page in the handbook.

If you have not had a chance, please review the Contribute with Code page in the WordPress Core Handbook.

The Developer Hub also documents the various coding standards that are followed:

Thank you,
The WordPress Project

This ticket was mentioned in Slack in #core by geoffguillain. View the logs.


3 weeks ago

This ticket was mentioned in Slack in #core by sergey. View the logs.


3 weeks ago

#5 @SergeyBiryukov
3 weeks ago

  • Milestone changed from Awaiting Review to 5.7

Hi there, welcome to WordPress Trac! Thanks for the ticket and the PR.

Yes, I think a filter makes sense there. It would need a documentation block as per the documentation standards, looks good to me otherwise.

#6 @SergeyBiryukov
3 weeks ago

  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#7 @Hareesh Pillai
3 weeks ago

  • Keywords needs-dev-note added

#8 @geoffguillain
12 days ago

A documentation block has been added to the PR.

#9 @Hareesh Pillai
10 days ago

Thanks for the update. It would be great if we could maintain consistency with the doc block for media_library_months_with_files filter.

#10 @geoffguillain
10 days ago

Thanks for pointing this out @hareesh-pillai.
The documentation block has been updated to be more consistent with the media_library_months_with_files filter.

Note: See TracTickets for help on using tickets.