Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Add your cpts to the Widget Activity of the Dashboard in WordPress
Plugin Name: Dashboard Widget Activity Custom Post Type
Plugin URI:
Author: Daniele Mte90 Scasciafratte
Version: 1.0.0
Author URI:
//Add the support for your cpt in the Widget Activity of the Admin Dashboard
if ( is_admin() ) {
add_filter( 'dashboard_recent_posts_query_args', 'add_page_to_dashboard_activity' );
function add_page_to_dashboard_activity( $query_args ) {
if ( is_array( $query_args[ 'post_type' ] ) ) {
//Set yout post type
$query_args[ 'post_type' ][] = 'page';
} else {
$temp = array( $query_args[ 'post_type' ], 'page' );
$query_args[ 'post_type' ] = $temp;
return $query_args;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment