Created
April 22, 2017 03:31
-
-
Save douglasanro/2f41b0a198f4822508c4a1694c4e3bf1 to your computer and use it in GitHub Desktop.
Add the support for your WordPress CPT in the widget activity of the admin 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 | |
/* ---------------------------------------------------------------------------- | |
* Add the support for your CPT in the widget activity of the admin dashboard | |
* ------------------------------------------------------------------------- */ | |
add_filter( 'dashboard_recent_posts_query_args', 'add_page_to_dashboard_activity' ); | |
function add_page_to_dashboard_activity( $query_args ) { | |
// Return all post types | |
$query_args['post_type'] = 'any'; | |
// Or return post types of your choice | |
// query_args['post_type'] = array( 'post', 'foo', 'bar' ); | |
if ( $query_args['post_status'] == 'publish' ) { | |
$query_args['posts_per_page'] = 10; | |
} | |
return $query_args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment