I know this has been asked before: Add file name column to media library I tried the code. The Filename column was not polpulated. Then I followed

Instead of substr( strrchr( $meta['file'], '/' ), 1) we can use basename( $meta['file'] ). The result is the same, but the code becomes more readable,

Then the Filename column got populated but now the sort order is all over the place. Definitely not sorted.

Any pointers on how to fix this are very much appreciated.

Thanks! cmyk


1 Answer 1


Found the solution:

I just changed "name" to "Filename" on this function:

// Register the column as sortable & sort by name
function filename_column_sortable( $cols ) {
    $cols["filename"] = "Filename";
    return $cols;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.