Created
May 11, 2018 21:22
-
-
Save wpfangirl/4c5170cf18c3ee0e572010f869aa8050 to your computer and use it in GitHub Desktop.
Show Custom Post Types in WordPress Dashboard "Recent Activity" Widget
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 // 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