[wp-trac] [WordPress Trac] #38686: Incorrect fallback value for label_count when registering a custom post status

WordPress Trac noreply at wordpress.org
Sun Nov 6 19:13:09 UTC 2016


#38686: Incorrect fallback value for label_count when registering a custom post
status
-------------------------------+----------------------------------------
 Reporter:  johnbillion        |      Owner:
     Type:  defect (bug)       |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Posts, Post Types  |    Version:
 Severity:  normal             |   Keywords:  needs-patch good-first-bug
  Focuses:  administration     |
-------------------------------+----------------------------------------
 When registering a custom post status, the `label_count` argument falls
 back to an array of the label names if it's not provided. This is
 incorrect and causes PHP notices on the post listing screen because the
 post status label expects a nooped plural. It should fallback to calling
 `_n_noop()`.

 Example code:

 {{{
 register_post_status( 'foo', [
         'label'                     => 'Foo',
         'show_in_admin_status_list' => true,
 ] );
 }}}

 PHP notices:

 {{{
 Undefined index: domain wp-includes/l10n.php:514
 Undefined index: context wp-includes/l10n.php:517
 Undefined index: singular wp-includes/l10n.php:520
 Undefined index: plural wp-includes/l10n.php:520
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38686>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list