Skip to content

Instantly share code, notes, and snippets.

@wpfangirl
Created May 11, 2018 21:22
Show Gist options
  • Save wpfangirl/4c5170cf18c3ee0e572010f869aa8050 to your computer and use it in GitHub Desktop.
Save wpfangirl/4c5170cf18c3ee0e572010f869aa8050 to your computer and use it in GitHub Desktop.
Show Custom Post Types in WordPress Dashboard "Recent Activity" Widget
<?php // Don't add the opening PHP tag. Instead, add this to your functionality plugin or at the end of functions.php.
//* Add All CPTs to "Recent Activity"
add_filter( 'dashboard_recent_posts_query_args', 'sinickas_dashboard_activity', 10, 1 );
function sinickas_dashboard_activity($query_args) {
$args = array(
// Excludes post types that don't show on the front end
'publicly_queryable' => true
);
$post_types = get_post_types($args);
$query_args['post_type'] = $post_types;
return $query_args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment