WordPress Snippets at WPcustoms

Add custom RSS Feed to dashboard

This function removes the default WordPress feeds. The second function adds your custom feed url to the admin dashboard. Customize as required.


/**
 * Snippet Name: Add custom RSS Feed to dashboard
 * Snippet URL: http://www.wpcustoms.net/snippets/add-custom-rss-feed-dashboard/
 */
 function wpc_dashboard_widgets() {
     global $wp_meta_boxes;
     // remove unnecessary widgets
     // var_dump( $wp_meta_boxes['dashboard'] ); // use to get all the widget IDs
     unset(
          $wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins'],
          $wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary'],
          $wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']
     );
     // add a custom dashboard widget
     wp_add_dashboard_widget( 'dashboard_custom_feed', 'News from siteXY', 'dashboard_custom_feed_output' ); //add new RSS feed output
}
function dashboard_custom_feed_output() {
     echo '
'; wp_widget_rss_output(array( 'url' => 'http://www.yoursite.com/feed', 'title' => 'Whats up at siteXY', 'items' => 4, 'show_summary' => 1, 'show_author' => 0, 'show_date' => 1 )); echo "
"; } add_action('wp_dashboard_setup', 'wpc_dashboard_widgets');