[wp-trac] [WordPress Trac] #49060: wp_die() to accept text_direction = 'ltr'

WordPress Trac noreply at wordpress.org
Fri Jul 24 23:49:30 UTC 2020


#49060: wp_die() to accept text_direction = 'ltr'
-------------------------------------+-----------------------------
 Reporter:  apedog                   |       Owner:  SergeyBiryukov
     Type:  defect (bug)             |      Status:  reviewing
 Priority:  normal                   |   Milestone:  5.5
Component:  I18N                     |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+-----------------------------
Changes (by SergeyBiryukov):

 * milestone:  5.6 => 5.5


Comment:

 > `wp_die()` only accepts `text_direction='rtl'`. It should accept `'ltr'`
 as well.

 To summarize the previous comments a bit, while `wp_die()` does accept the
 `text_direction` argument, it is only used as a fallback if neither
 `language_attributes()` nor `is_rtl()` are available, e.g. if WordPress is
 loaded in `SHORTINIT` mode or is not fully loaded in some other way.

 Some history:
 * The argument was introduced in [11408] / #6132 for a single instance in
 `wp-load.php`.
 * That instance was later removed in [19760] / #18180, since then the
 argument is not used anywhere in core.

 So, technically both `ltr` and `rtl` are already accepted, it's just that
 `get_language_attributes()`, once available, overrides the passed
 `text_direction` value. The suggestion in this ticket is to flip the order
 and only use the value of `get_language_attributes()` if `text_direction`
 was not explicitly passed.

 [attachment:"49060.2.diff"] simplifies the logic a bit and adds
 documentation.

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


More information about the wp-trac mailing list