<p>I have not tried but you could probably use the CP Custom JavaScript plugin to force display of <code>.notification.error</code> as the flash only sets <code>display: none;</code> and does not remove the element.</p>

CC BY-SA 3.0
2014-08-19T22:15:43.163Z
That's a great idea, thanks Shane! I'll give that a whirl and let you know how it works out.
Lindsey D
CC BY-SA 3.0
2014-08-19T22:07:07.977Z
2014-08-19T22:07:07.977Z
Shane Hudson
<p>Not currently. The CP’s Javascript will automatically hide all flash messages 2 or 4 seconds after page load (4 if it’s an error).</p>

CC BY-SA 3.0
2014-08-19T22:17:46.243Z
Fair enough, thanks Brandon. Maybe I'll submit it as an official feature request. ;)
Lindsey D
CC BY-SA 3.0
2014-08-19T21:13:06.223Z
2014-08-19T21:13:06.223Z
Brandon Kelly
<p>It's possible to generate a "flash" error message at the top of the control panel like this:</p>

<pre class="lang-php prettyprint-override"><code>craft()-&gt;userSession-&gt;setError('Your custom plugin error message.');
</code></pre>

<p>The message appears at the top of the control panel when the page loads, but then fades away after a few seconds. <strong>Is there any way to "pin" the message to the top of the page, so it stays indefinitely?</strong></p>

<plugin-development><error-message>
How do you "pin" a flash error message in the CP?
# How do you "pin" a flash error message in the CP?

(Asked by: username_0 on 2014-08-18)

It's possible to generate a "flash" error message at the top of the control panel like this:
craft()->userSession->setError('Your custom plugin error message.');

The message appears at the top of the control panel when the page loads, but then fades away after a few seconds. Is there any way to "pin" the message to the top of the page, so it stays indefinitely?

**Tags:** plugin-development, error-message

---

## 2 answers

### Answer by username_1 on 2014-08-19. Score: 2 | Accepted answer

I have not tried but you could probably use the CP Custom JavaScript plugin to force display of `.notification.error` as the flash only sets `display: none;` and does not remove the element.

> **Comments:**
> **username_0**: That's a great idea, thanks Shane! I'll give that a whirl and let you know how it works out.  

---

### Answer by username_2 on 2014-08-19. Score: 1

Not currently. The CP’s Javascript will automatically hide all flash messages 2 or 4 seconds after page load (4 if it’s an error).

> **Comments:**
> **username_0**: Fair enough, thanks Brandon. Maybe I'll submit it as an official feature request. ;)  

---

