-
-
Save eyecandy91/eda8d1fcb8538e67c33e2a3eee9a24e9 to your computer and use it in GitHub Desktop.
Add your cpts to the Widget Activity of the Dashboard in WordPress
This file contains hidden or 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 | |
/* | |
Plugin Name: Dashboard Widget Activity Custom Post Type | |
Plugin URI: | |
Description: | |
Author: Daniele Mte90 Scasciafratte | |
Version: 1.0.0 | |
Author URI: http://mte90.net | |
*/ | |
//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