Created
October 23, 2018 00:02
-
-
Save NickGreen/867fa619d0794a13601dd88ff193d957 to your computer and use it in GitHub Desktop.
Sort subscriptions on 'my subscriptions' page by ascending or descending order
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('wcs_get_users_subscriptions','sort_subscriptions', 10, 2); | |
function sort_subscriptions( $subscriptions, $user_id ){ | |
// choose either ksort or krsort | |
// in ascending order by ID | |
// ksort($subscriptions); | |
// in descending order by ID | |
krsort($subscriptions); | |
return $subscriptions; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment