The install_plugins_table_header WordPress PHP action fires before the Plugin Install table header pagination is displayed.
Usage
add_action('install_plugins_table_header', 'your_custom_function');
function your_custom_function() {
// Your custom code here
}
Parameters
- None
More information
See WordPress Developer Resources: install_plugins_table_header
Examples
Add a custom message above the plugin table header
This code adds a custom message above the plugin table header on the plugin installation page.
add_action('install_plugins_table_header', 'add_custom_message');
function add_custom_message() {
echo '<p><strong>Note:</strong> Please make sure to read the plugin documentation before installing.</p>';
}
Display a list of recommended plugins
This code displays a list of recommended plugins above the plugin table header.
add_action('install_plugins_table_header', 'display_recommended_plugins');
function display_recommended_plugins() {
$recommended_plugins = array(
'Plugin One',
'Plugin Two',
'Plugin Three'
);
echo '<p><strong>Recommended Plugins:</strong></p>';
echo '<ul>';
foreach ($recommended_plugins as $plugin) {
echo '<li>' . $plugin . '</li>';
}
echo '</ul>';
}
Add a search filter for your custom plugin category
This code adds a search filter for your custom plugin category on the plugin installation page.
add_action('install_plugins_table_header', 'add_custom_plugin_filter');
function add_custom_plugin_filter() {
echo '<label for="custom-category-filter">Custom Category: </label>';
echo '<input type="text" id="custom-category-filter" name="custom-category-filter">';
}
Display a custom message based on user role
This code displays a custom message above the plugin table header based on the user role.
add_action('install_plugins_table_header', 'display_message_based_on_role');
function display_message_based_on_role() {
if (current_user_can('manage_options')) {
echo '<p><strong>Note for Administrators:</strong> Make sure to configure the plugin settings after installation.</p>';
}
}
Add custom CSS styles to the plugin table header
This code adds custom CSS styles to the plugin table header on the plugin installation page.
add_action('install_plugins_table_header', 'add_custom_css');
function add_custom_css() {
echo '<style>.plugin-install-php .wp-list-table th { background-color: #f1f1f1; border-bottom: 1px solid #ccc; }</style>';
}