I have customised the welcome panel on the dashboard for users with information in. I then hid the “Dismiss” button and added CSS to make the welcome panel always visible. Using the ‘welcome_panel’ hook.
This works fine for Admins but the Welcome Panel is not displayed for other users such as editors and authors. Its not that the admin panel is being hidden its not included in the source code.
I need to find a way to include the welcome panel code for every user not just admins.
Just found the following in wp-admin/index.php
. So it will only show if user can edit_theme_options.
<?php if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
Is there a way to edit this or call the do_action( ‘welcome_panel’ ); even if the user cannot edit_theme_options?
This is how I solved it:
In functions.php
dashboard-panel.php
As you already discovered, the display conditions for that panel are hard-coded into a core file. It isn’t meant to be changed, which means you are probably trying to use the panel for something it is not intended for. That isn’t criticism. It just makes it hard. I don’t see a way to change that except by editing a core file, and I don’t advise that.
You can try to run the
welcome_panel
action on some other hook, like one of these, for example, but I wouldn’t expect it to work correctly. If you really, really need thewelcome_panel
to run for everyone that is your best bet, but I wouldn’t be hopeful.You could also give everyone
edit_theme_options
capability, but that is a bad idea. I am ashamed I thought of it. 🙂From what I can tell, your options are pretty limited and really boil down to “core edit”. That is a high-maintenance path to start down. I’d suggest that you put your user information somewhere else, like in a new Dashboard Widget, in a Help screen, or in the admin bar.