[wp-trac] [WordPress Trac] #38342: Quick Draft: Leverage REST API endpoints

WordPress Trac noreply at wordpress.org
Wed Nov 2 18:40:15 UTC 2016


#38342: Quick Draft: Leverage REST API endpoints
---------------------------------+-----------------------------------
 Reporter:  adamsilverstein      |       Owner:
     Type:  enhancement          |      Status:  new
 Priority:  normal               |   Milestone:  Future Release
Component:  Administration       |     Version:
 Severity:  normal               |  Resolution:
 Keywords:  has-patch 4.8-early  |     Focuses:  javascript, rest-api
---------------------------------+-----------------------------------

Comment (by adamsilverstein):

 In [attachment:38342.4.diff]
 * Add support for the legacy `dashboard_recent_drafts_query_args` filter
 that currently runs in `wp_dashboard_recent_drafts`. The filter is applied
 to both the shell count query and the rest_api callback query, enabling
 developers to (continue) modifying the default behaviour of the recent
 drafts list. Existing filter usage should continue to work.

 For example, I tested increasing the number of drafts shown in the list to
 10 using the following code in my theme `functions.php`, similar code
 could modify the query to change the defaults, for example adding a cpt or
 showing drafts from all users:

 {{{
 // Show 10 drafts in the recent draft list in the quick draft dashboard
 widget.
 function filter_the_draft_list( $query_args ) {
         $query_args['posts_per_page'] = 10;
         return $query_args;
 }
 add_filter( 'dashboard_recent_drafts_query_args', 'filter_the_draft_list'
 );
 }}}

 Here is a screenshot of the result:

 [[Image(https://cl.ly/3W3w0E2f3v3u/Dashboard__wpdev__WordPress_2016-11-02_14-38-54.jpg)]]

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38342#comment:38>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list