Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* filter pay author stats */
- add_filter( 'jpwt_formatted_stats', 'only_author' );
- function only_author( $formatted_stats ) {
- foreach ( $formatted_stats['stats'] as $key => $stats ) {
- $user = get_userdata( $stats['author_id'] );
- if ( ! in_array( 'author', $user->roles ) ) {
- unset( $formatted_stats['stats'][ $key ] );
- }
- }
- $formatted_stats['stats'] = array_values( $formatted_stats['stats'] );
- return $formatted_stats;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement