Skip to content

Instantly share code, notes, and snippets.

@slaFFik
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slaFFik/960e430be294e19c3331 to your computer and use it in GitHub Desktop.
Save slaFFik/960e430be294e19c3331 to your computer and use it in GitHub Desktop.
Do not display Recent Posts in Activity widget in WordPress Dashboard
<?php
if ( strpos($_SERVER['SCRIPT_FILENAME'], 'wp-admin/index.php') && !defined('DOING_AJAX')) {
add_filter('the_posts', 'dndrpawwd', 10, 2);
}
function dndrpawwd($posts, $obj){
$trace = debug_backtrace();
foreach($trace as $item) {
if ($item['function'] == 'wp_dashboard_recent_posts' ) {
$posts = array();
break;
}
}
return $posts;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment