WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #23421, comment 15


Ignore:
Timestamp:
02/28/2020 09:03:36 PM (9 months ago)
Author:
cr0ybot
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #23421, comment 15

    initial v1  
    11I took a crack at this in 23421.2.diff—it's a more complicated feature than it seems on the face of it. Most notably, ordering by a taxonomy column, where multiple terms may be present on a single post, actually means ordering by the plain-text list of terms concatenated. So any posts with just "Term A" applied will be grouped, and then a post with "Term A, Term B" will come after.
     2
     3The biggest change to the SQL was to put the taxonomy table joins into a subselect so that we don't drop posts without any terms.
    24
    35After all this effort, I wonder if orderby on a taxonomy column even makes sense. It seems as though a more generic taxonomy filter (as suggested by @tifosi as a show_admin_filter option) would provide more predictable or expected results.
    46
    57I used most of what @jtsternberg had, though I moved most of the functionality into the WP_Posts_List_Table since that seemed to be the precedence set by the code for `show_admin_column`. I also added the setting to the `WP_Taxonomy` class, and the `posts_clauses` filter is applied in `admin-filters.php`.
     8
     9NOTE: I accidentally included another commit, I'm attempting to clean it up now...