Last active
September 11, 2017 18:50
-
-
Save amdrew/7477544 to your computer and use it in GitHub Desktop.
Allows you to search by the payment ID on the downloads > payment history screen. Also allows you to search on the downloads page if you know the ID.
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 | |
function edd_search_by_id( $where ) { | |
if( is_admin() ) { | |
global $wpdb, $pagenow, $typenow; | |
if ( ! ( 'download' == $typenow && in_array( $pagenow, array( 'edit.php' ) ) ) ) | |
return $where; | |
if ( isset( $_GET['s'] ) && !empty( $_GET['s'] ) && intval( $_GET['s'] ) != 0 ) { | |
$where .= ' or ' . $wpdb->posts . '.ID = ' . $_GET['s']; | |
} | |
} | |
return $where; | |
} | |
add_filter( 'posts_where', 'edd_search_by_id' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment