jjgrainger / PostTypes

Simple WordPress custom post types.
https://posttypes.jjgrainger.co.uk/
MIT License
373 stars 47 forks source link

Make sure the "orderby" query var is a string when sorting by columns. #46

Closed aymanalzarrad closed 4 years ago

aymanalzarrad commented 5 years ago

Hi,

The 'orderby' query var is a mixed var string|array, and the method PostType::sortSortableColumns assumes is a string when passing it to array_key_exists which expects a key of type int|string. This pull request fixes the following PHP warning. PHP Warning: array_key_exists(): The first argument should be either a string or an integer

jjgrainger commented 4 years ago

Thank you for the PR.

There was a merge conflict with #55 which I resolved by moving the is_string check to Columns.php#L155 to work with the recent changes.