The paused_themes_notice() WordPress PHP function renders an admin notice when some themes have been paused due to errors.
Usage
To use the paused_themes_notice() function, simply call it in your theme or plugin file where you want to display the notice:
paused_themes_notice();
Parameters
- There are no parameters for this function.
More information
See WordPress Developer Resources: paused_themes_notice
This function is available since WordPress version 5.2.
Examples
Display a notice when a theme is paused
Display a notice in the admin area when a theme is paused due to an error.
add_action('admin_notices', 'show_paused_themes_notice');
function show_paused_themes_notice() {
paused_themes_notice();
}
Conditional display of paused themes notice
Only display the paused themes notice on specific admin pages.
add_action('admin_notices', 'show_paused_themes_notice_on_plugins_page');
function show_paused_themes_notice_on_plugins_page() {
if (get_current_screen()->id == 'plugins') {
paused_themes_notice();
}
}
Add custom message to paused themes notice
Append a custom message to the default paused themes notice.
add_action('admin_notices', 'add_custom_message_to_paused_themes_notice');
function add_custom_message_to_paused_themes_notice() {
paused_themes_notice();
echo '<div class="notice notice-warning"><p><strong>Reminder:</strong> Please fix the errors to resume the paused themes.</p></div>';
}
Modify the paused themes notice
Change the default message of the paused themes notice.
add_filter('paused_themes_notice_text', 'modify_paused_themes_notice_text');
function modify_paused_themes_notice_text($notice_text) {
$notice_text = 'A custom message for paused themes due to errors.';
return $notice_text;
}
Remove paused themes notice
Remove the paused themes notice from the admin area.
remove_action('admin_notices', 'paused_themes_notice');