[wp-trac] [WordPress Trac] #45035: allow register_post_type() arg to control whether a CPT's counts are added to the "At a Glance" Dashboard widget

WordPress Trac noreply at wordpress.org
Wed Oct 3 15:45:26 UTC 2018


#45035: allow register_post_type() arg to control whether a CPT's counts are added
to the "At a Glance" Dashboard widget
-------------------------------+------------------------------
 Reporter:  pbiron             |       Owner:  (none)
     Type:  enhancement        |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Posts, Post Types  |     Version:
 Severity:  normal             |  Resolution:
 Keywords:  dev-feedback       |     Focuses:  administration
-------------------------------+------------------------------
Description changed by pbiron:

Old description:

> It would be nice if there an arg to `register_post_type()` that
> controlled whether the CPT's counts were added to the "At a Glance"
> Dashboard widget, e.g.
>
> {{{#!php
> register_post_type( 'mycpt', array( ..., 'at_a_glance' => true, ... ) );
> }}}
>
> Ideally, I think it should default to the value of `show_in_menu`, but as
> current behavior is the equivalent of `false` I'd be OK with that as the
> default as well.
>
> Another "nice to have" would be to allow the param to take a string value
> that would be interpreted as a `post_status` to show the count for, e.g.,
> show counts for custom post_status = `mycustompoststatus` instead of
> `publish`.
>
> I have code that does all of the above, but it would have to be
> refactored a little bit to submit as a patch (especially to account for
> the `_builtin` post_types that already appear in AAG).
>
> If folks think this would be a good enhancement I'd be glad to work on
> that refactoring and submit a patch.

New description:

 It would be nice if there an arg to `register_post_type()` that controlled
 whether the CPT's counts were added to the "At a Glance" Dashboard widget,
 e.g.

 {{{#!php
 <?php
 register_post_type( 'mycpt', array( ..., 'at_a_glance' => true, ... ) );
 }}}

 Ideally, I think it should default to the value of `show_in_menu`, but as
 current behavior is the equivalent of `false` I'd be OK with that as the
 default as well.

 Another "nice to have" would be to allow the param to take a string value
 that would be interpreted as a `post_status` to show the count for, e.g.,
 show counts for custom post_status = `mycustompoststatus` instead of
 `publish`.

 I have code that does all of the above, but it would have to be refactored
 a little bit to submit as a patch (especially to account for the
 `_builtin` post_types that already appear in AAG).

 If folks think this would be a good enhancement I'd be glad to work on
 that refactoring and submit a patch.

--

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


More information about the wp-trac mailing list