PHPackages                             julien731/wp-dismissible-notices-handler - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. julien731/wp-dismissible-notices-handler

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

julien731/wp-dismissible-notices-handler
========================================

A simple library to handle Ajax-dismissible admin notices for WordPress

1.2.2(5y ago)456.4k↑150%10[4 issues](https://github.com/julien731/WP-Dismissible-Notices-Handler/issues)[1 PRs](https://github.com/julien731/WP-Dismissible-Notices-Handler/pulls)1GNU GPLPHPPHP &gt;=5.5.0

Since Apr 3Pushed 3y ago3 watchersCompare

[ Source](https://github.com/julien731/WP-Dismissible-Notices-Handler)[ Packagist](https://packagist.org/packages/julien731/wp-dismissible-notices-handler)[ Docs](https://github.com/julien731/WP-Dismissible-Notices-Handler)[ RSS](/packages/julien731-wp-dismissible-notices-handler/feed)WikiDiscussions develop Synced 3d ago

READMEChangelog (4)DependenciesVersions (7)Used By (1)

WordPress Dismissible Notices Handler
=====================================

[](#wordpress-dismissible-notices-handler)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/6ba045750c506811664e584d490a2a16be157bed7b6b8236edab8b2b6d2dd57a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a756c69656e3733312f57502d4469736d69737369626c652d4e6f74696365732d48616e646c65722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/julien731/WP-Dismissible-Notices-Handler/?branch=master)

Since version 4.2, WordPress has a built-in mechanism for handling dismissible admin notices. While this mechanism handles dismissing notices, the dismissal isn't persistent. This means that a user would see the notice on every page load, even though he or she dismissed the notice already.

What the Dismissible Notices Handler (DNH) library does is handle the persistent part of dismissing admin notices.

How It Works
------------

[](#how-it-works)

The DNH library is extremely simple to use and yet has a couple of advanced options.

The basics of it is to register a new admin notice. You really need 3 things for registering a notice:

- a unique ID that will identify the notice (you will be warned in case of ID conflicts)
- a notice type
- a message to display in the notice

There is a handy helper function available for notice registration: `dnh_register_notice()`

This function takes 4 parameters:

- `$id` *(string)*: the unique ID of the notice
- `$type` *(string)*: the type of notice you want to display. Currently it can be `error` for an error notice or `updated` for a success/update notice
- `$content` *(string)*: the content of the admin notice
- `$args` *(array)*: additional parameters that can be passed to the notice handler (see below)

#### Installation

[](#installation)

The simpest way to use DNH is to add it as a Composer dependency:

```
composer require julien731/wp-dismissible-notices-handler

```

### Example

[](#example)

Registering an admin notice would look like that:

```
dnh_register_notice( 'my_notice', 'updated', __( 'This is my notice' ) );

```

Advanced Parameters
-------------------

[](#advanced-parameters)

The function takes an array of optional parameters allowing more control over the notices and how they're dismissed. Only 3 parameters are available so far but hopefully more will be coming soon.

Hereafter is the list of available parameters to be passed in the `$args` array. Please note that the `$args` parameter is optional.

ParameterPossible Value(s)DefaultDescriptionscopeuser, globaluserWhether the notice should be dismissed for the current user only or globally on the site. A notice dismissed for a user will still show up for other users, while a notice dismissed globally will not be displayed anymore after being dismissed once.capAny WordPress capabilityIf not empty, the handler will check if the current user has the specified before displaying the notice.classstringAdditional class to add to the notice wrapper

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~445 days

Total

5

Last Release

1964d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1441024?v=4)[Julien Liabeuf](/maintainers/julien731)[@julien731](https://github.com/julien731)

---

Top Contributors

[![julien731](https://avatars.githubusercontent.com/u/1441024?v=4)](https://github.com/julien731 "julien731 (24 commits)")[![Mte90](https://avatars.githubusercontent.com/u/403283?v=4)](https://github.com/Mte90 "Mte90 (5 commits)")[![ramiy](https://avatars.githubusercontent.com/u/576623?v=4)](https://github.com/ramiy "ramiy (4 commits)")[![nextgenthemes](https://avatars.githubusercontent.com/u/1780826?v=4)](https://github.com/nextgenthemes "nextgenthemes (2 commits)")[![tangrufus](https://avatars.githubusercontent.com/u/2259834?v=4)](https://github.com/tangrufus "tangrufus (1 commits)")

### Embed Badge

![Health badge](/badges/julien731-wp-dismissible-notices-handler/health.svg)

```
[![Health](https://phpackages.com/badges/julien731-wp-dismissible-notices-handler/health.svg)](https://phpackages.com/packages/julien731-wp-dismissible-notices-handler)
```

###  Alternatives

[wyrihaximus/file-descriptors

List open file descriptors for the current process cross platform

16266.3k2](/packages/wyrihaximus-file-descriptors)[subzeta/ruling

An stateless rule engine

2012.1k](/packages/subzeta-ruling)[kijtra/textdiff

Simple text diff Class. 簡易的なテキスト比較ライブラリです。

491.6k](/packages/kijtra-textdiff)[rezozero/social-links

Provide social network url for sharing.

155.9k1](/packages/rezozero-social-links)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
