Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

The quickest way to add an alert bar in WordPress is to install a notification-bar plugin, activate it, configure the message and display rules, save, and then inspect the live site on desktop and mobile. If you need complete control over markup or behavior, add a custom bar through the wp_body_open hook in a theme or plugin.

Choose the right implementation

Your choice mainly depends on how much control you need and who will maintain the site.

Approach Best for What you manage
Notification-bar plugin Site owners who want a setup through the WordPress dashboard Message, position, appearance, targeting, scheduling, dismissal and calls to action, depending on the plugin
Custom code Developers who need bespoke markup, styling or behavior Hook placement, escaping, CSS, responsive behavior, accessibility and compatibility

Plugin-directory descriptions are vendor claims rather than independent compatibility tests. A feature listed by a plugin may behave differently with your theme, caching layer or other plugins.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Create an alert bar with a plugin

1. Install and activate the plugin

  1. In the WordPress dashboard, go to Plugins > Add New.
  2. Search for an announcement or notification-bar plugin, review its current author, update history and compatibility information, and select Install Now.
  3. Choose Activate. If you received a ZIP file instead, use Plugins > Add New > Upload Plugin, upload the ZIP, install it and activate it.

2. Open the plugin settings

The Announcement Notification Bar listing documents a flow of opening Settings > Announcement Notification Bar, changing the options, saving them and visiting the site to inspect the result. Other plugins may place their controls under a different dashboard menu.

3. Write a short, actionable message

State what visitors need to know and what they can do next. For example, “Scheduled maintenance: checkout is unavailable from 02:00–03:00 UTC. View status.” Keep the wording understandable without relying on color or animation.

4. Set position and behavior

Depending on the plugin, choose a top or bottom bar and decide whether it is static, fixed or scrolling. A fixed bar remains visible while the visitor scrolls, but it can cover navigation, headings or buttons if the theme does not reserve space for it.

5. Configure appearance and controls

Common vendor-listed controls include colors, typography, links, buttons, running text and carousel styles. If you enable rotating messages, make sure each message remains long enough to read and that visitors can pause or close the bar.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

6. Limit where and when it appears

Some listings describe whole-site, homepage or selected-content targeting; desktop and mobile visibility; start and end scheduling; and dismissal cookies. Use these controls to avoid showing a campaign after it expires or displaying a page-specific notice on unrelated pages.

7. Save and verify

  1. Select the plugin’s Save or equivalent button.
  2. Open the public site in a private browser window and visit every page type where the bar should appear.
  3. Test a narrow mobile viewport as well as a desktop viewport.
  4. Activate every link and button, then test the close control and revisit the page to see whether dismissal behaves as you intended.

Build a custom bar with wp_body_open

The WordPress Developer Blog demonstrates outputting an announcement immediately after the opening <body> tag by attaching a callback to wp_body_open. This is a development approach, not a guarantee that every theme will render the hook correctly.

Implementation requirements

  • Use a child theme or a site-specific plugin so a theme update does not erase the change.
  • Confirm that the active theme calls wp_body_open() in its header.
  • Read the message and other settings from stored options rather than hard-coding content when editors need to change it.
  • Escape text with esc_html() and attribute values with esc_attr(), as shown in the Developer Blog example.
  • Use a maintainable stylesheet; the example also demonstrates composing CSS with WordPress style-engine functionality.

Hook the output

A simplified pattern is to register a callback on wp_body_open and print a container for the notice:

add_action( 'wp_body_open', 'my_alert_bar' );

function my_alert_bar() {
    $message = get_option( 'my_alert_message', '' );

    if ( '' === $message ) {
        return;
    }

    echo '<div class="my-alert-bar" role="status">';
    echo esc_html( $message );
    echo '</div>';
}

This example intentionally keeps the output simple. Add links, a close button, targeting logic and styles only after deciding how they should work on keyboard, touch and assistive-technology interfaces. If editors must enter trusted HTML, use an appropriate WordPress sanitization method instead of changing an escaped text value into unfiltered output.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Compare plugins before committing

Use the following checklist when evaluating a plugin’s current listing and documentation:

  • Top or bottom placement
  • Fixed or static behavior
  • Whole-site, homepage or selected-page targeting
  • Separate desktop and mobile visibility
  • Start and end scheduling
  • Dismissal controls and cookie duration
  • Plain text, links, buttons, CTA fields or multiple messages
  • Keyboard access, readable contrast and any stated accessibility conformance
  • Current WordPress and PHP compatibility, update history and support activity

For example, WP Alerts Bars listings describe targeting, device visibility, scheduling and dismissal cookies; Varsby describes placement, sticky behavior, an optional CTA and an author claim of WCAG 2.2 AA conformance; FooBar lists announcement, CTA and cookie-notice types. These descriptions should guide questions, not substitute for testing your installation.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Accessibility and layout checks

  • Use sufficient color contrast and readable text at normal browser zoom.
  • Make links and buttons identifiable without color alone.
  • Provide a keyboard-reachable close control with an accessible name.
  • Do not make essential information available only through moving or rotating text.
  • Check that a fixed bar does not hide the site header, skip link, cookie controls, form fields or the page’s primary content.
  • Confirm that the notice remains usable when text wraps over several lines on a phone.

Troubleshoot common failures

The bar does not appear

Check that the plugin is active, the message is not empty, the current URL matches its targeting rules, the schedule is active and any device filter includes your viewport. For custom code, verify that the theme calls wp_body_open() and that another callback or optimization tool has not removed the output.

The bar covers content

Change fixed behavior to static, add appropriate top or bottom spacing, or adjust the bar’s stacking and layout rules. Recheck pages with sticky headers, admin bars and mobile navigation.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The close button does not stay closed

Inspect the plugin’s dismissal-cookie setting, test in a fresh private window and check whether a cache or consent tool is preventing the cookie from being stored.

Styles look wrong after caching

Clear page, browser and CDN caches, then test again. If the problem returns, inspect CSS specificity and whether the optimization tool is combining or delaying the bar’s stylesheet.

Final verification checklist

  1. Read the message as a first-time visitor on the pages you targeted.
  2. Check desktop and mobile layouts, including browser zoom.
  3. Follow every link and CTA.
  4. Use the keyboard to reach and activate controls.
  5. Test dismissal and scheduling behavior.
  6. Confirm that fixed positioning does not obscure important content.
  7. Recheck after clearing caches and while logged out.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.