[wp-trac] [WordPress Trac] #43844: Inline documentation for WP_List_Table::get_sortable_columns is wrong
WordPress Trac
noreply at wordpress.org
Tue Apr 24 13:18:56 UTC 2018
#43844: Inline documentation for WP_List_Table::get_sortable_columns is wrong
----------------------------+-----------------------------------
Reporter: javorszky | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version:
Severity: minor | Resolution:
Keywords: dev-feedback | Focuses: docs, administration
----------------------------+-----------------------------------
Changes (by javorszky):
* keywords: has-patch => dev-feedback
Comment:
Oh, hold on, this adds a different problem. Because `$sortable[
$column_key ]` is now an array, if the default sort direction is not
defined, the `list` call will try to access the array offset 1, which
doesn't exist, throwing an undefined offset Notice.
Need feedback on how best to solve this.
tldr:
1. either we leave the sortable column definition as a string, in which
case the `orderby` isn't getting added, so the column is useless, or
2. we move to an array, but then leaving out offset 1 of the array
(default direction), which will make sorting work, but will throw a notice
in php
The solutions are
1. we can fall back to dealing with orderby as a string, or
2. sanitize the array to make sure there's always a default order present
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43844#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list