Skip to Content
SDKDisplaying Announcements

Displaying Announcements

Announcements are messages you (the plugin vendor) send to your users’ WordPress dashboards from the Appneck Org Panel — feature news, important updates, notices, etc.

As of the realtime config delivery update, this is now fully automatic. bootstrap() wires announcements to appear on every wp-admin page for a capable user, kept fresh in the background — there is nothing to call and nothing to wire for the standard case. The manual methods below still exist for anyone who wants the narrower, opt-in behaviour instead.

What’s automatic now

After bootstrap(), without any further code:

  • Announcements render on every wp-admin page, not just one you name, for any user who can manage_options.
  • The page never waits on a network call to show them — it paints from cache immediately, then a background request (after the page has already loaded) checks for anything new and updates the notice in place, with no page reload.
  • An announcement marked urgent (see below) reaches an already-open wp-admin tab within about a minute, without the admin navigating anywhere.
  • Dismissing a notice hides it instantly and stays hidden after a reload, even if Appneck is briefly unreachable when the click happens.

If you want the OLD, narrower behaviour instead — one specific screen, no background refresh between page loads — the manual methods are still there:

MethodUse when
render_on_screen( $screen_id )You want the ORIGINAL one-screen-only behaviour instead of the new global default.
render()You’re calling from inside your own admin callback and want it drawn right at that point, with no automatic background refresh.

⚠️ Don’t call render_on_screen() or render() in addition to the new default. Since bootstrap() already wires the global version, calling either of these as well prints your announcements a second time on whichever screen they target. Use them only if you are deliberately replacing the automatic behaviour, not layering on top of it.

The is_urgent option (for you, publishing from the Org Panel)

When publishing or editing an announcement in the Org Panel, you can mark it urgent. This is a delivery-speed setting, separate from the announcement’s type (security/feature/discount/update) — an urgent discount and a non-urgent security notice are both legitimate combinations.

  • Urgent: reaches every open wp-admin tab within about a minute, with no navigation needed.
  • Not urgent (the default): appears on a site’s next wp-admin page load — still automatic, just not pushed to an already-open tab.

Use urgent sparingly — for things that are actually time-critical (an active security issue, a launch-day promotion). Most announcements don’t need it.

How fetching and caching actually works (so the timing makes sense)

  • The page itself never makes the admin wait — rendering is always from cache first.
  • A background request after page load refreshes the cache if it’s stale or more than 60 seconds old.
  • While a wp-admin tab stays open, a lightweight check runs every 60 seconds to see whether anything urgent has appeared; only an urgent change pulls the full announcement content into that open tab. A non-urgent change simply waits for the next page load — checking on every version change would defeat the point of having an urgent flag at all.
  • The 60-second check pauses while the tab is hidden and stops entirely after 30 minutes with no interaction on the page, so a forgotten tab doesn’t poll forever.
  • If Appneck is unreachable, the site shows whatever was last cached and nothing about the failure is shown to the admin. After a few consecutive failures, the SDK stops trying for about 15 minutes before checking again — this recovers on its own and needs no action from you.
  • Announcements are not consent-gated (unlike telemetry). They’re authenticated vendor-to-user messages, so they work regardless of the site owner’s telemetry consent choice.

Building your own custom rendering (advanced)

If the built-in notice styling doesn’t fit, announcements() (without _notices) gives you the raw data to render however you like:

foreach ( $sdk->announcements()->visible() as $announcement ) { // render $announcement yourself }

Note that this reads the local cache only, same as the automatic renderer — it does not itself trigger the background refresh or the urgent poll.

Next: Heartbeats & Installations →