Created
June 21, 2018 08:47
-
-
Save kadimi/3a2e7920402375cbc31b6d0bf98a377c to your computer and use it in GitHub Desktop.
Order SportsPress events by date in ascending order in the dashboard
This file contains 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 | |
/** | |
* Order SportsPress events by date in ascending order in the dashboard. | |
*/ | |
add_action( 'admin_init', function() { | |
if ( empty( $_GET[ 'post_type' ] || 'sp_event' !== $_GET[ 'post_type' ] ) ) { | |
return; | |
} | |
if ( ! empty( $_GET[ 'orderby' ] ) ) { | |
return; | |
} | |
if ( ! empty( $_GET[ 'order' ] ) ) { | |
return; | |
} | |
$_GET[ 'orderby' ] = 'date'; | |
$_GET[ 'order' ] = 'asc'; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment