The dashboard_secondary_items WordPress PHP filter allows you to change the number of secondary link items displayed in the ‘WordPress Events and News’ dashboard widget.
Usage
add_filter('dashboard_secondary_items', 'your_custom_function'); function your_custom_function($items) { // your custom code here return $items; }
Parameters
$items
(int): The number of items to show in the secondary feed.
More information
See WordPress Developer Resources: dashboard_secondary_items
Examples
Increase the number of secondary items displayed to 10
This code will increase the number of secondary items shown in the ‘WordPress Events and News’ widget to 10.
add_filter('dashboard_secondary_items', 'increase_secondary_items'); function increase_secondary_items($items) { $items = 10; return $items; }
Display only 5 secondary items
This code will reduce the number of secondary items shown in the ‘WordPress Events and News’ widget to 5.
add_filter('dashboard_secondary_items', 'decrease_secondary_items'); function decrease_secondary_items($items) { $items = 5; return $items; }
Remove all secondary items
This code will remove all secondary items from the ‘WordPress Events and News’ widget.
add_filter('dashboard_secondary_items', 'remove_secondary_items'); function remove_secondary_items($items) { $items = 0; return $items; }
Double the number of secondary items
This code will double the number of secondary items shown in the ‘WordPress Events and News’ widget.
add_filter('dashboard_secondary_items', 'double_secondary_items'); function double_secondary_items($items) { $items *= 2; return $items; }
Set the number of secondary items to a custom value
This code will set the number of secondary items shown in the ‘WordPress Events and News’ widget to a custom value stored in a variable.
add_filter('dashboard_secondary_items', 'set_custom_secondary_items'); function set_custom_secondary_items($items) { $custom_value = 7; $items = $custom_value; return $items; }