Repository navigation
Administration: Pass the container ID to dashboard_recent_posts_query_args - #16194
ankit-addweb wants to merge 2 commits into
Conversation
…y_args`. The Recent Activity dashboard widget builds two lists, "Publishing Soon" and "Recently Published", with `wp_dashboard_recent_posts()`. The existing `dashboard_recent_posts_query_args` filter runs for both and gave callbacks no way to tell them apart. Pass the container ID (`future-posts` or `published-posts`) as a second argument so the query can be adjusted per list, without adding new hooks. See #37578.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Trac ticket: https://core.trac.wordpress.org/ticket/37578
What
Passes the container ID (
future-posts/published-posts) as a second argument to the existingdashboard_recent_posts_query_argsfilter inwp_dashboard_recent_posts().Why
The Recent Activity widget runs this filter for two lists, and callbacks couldn't tell them apart. Per @desrosj's suggestion on the ticket, this adds control without introducing new hooks. It is backward compatible: one-argument callbacks keep working.
This takes the same approach as #9026 and the patches by @pmbaldha, with
@sinceset toX.Y.Zand a PHPUnit test added.How to test
add_filter( 'dashboard_recent_posts_query_args', $cb, 10, 2 );that logs$id.wp_dashboard_recent_posts()for both lists).future-postsandpublished-posts.npm run test:php -- --filter Tests_Admin_wpDashboardRecentPosts