For highly customized WordPress installations is can be useful to have specific instructions in usage for specific pages. These instructions could be in the form of a FAQ, a step-by-step instruction list, a helpful flash-animation, there are several options available.

For specific targeting of instructions we can use  $current_screen to detect where the user is.

$current_screen

I stumbled into the $current_screen global variable by chance, looking for something else in the WordPress source code. This little documented global variable contains information about which page specifically you are currently viewing in the WordPress administration interface.

Using this variable you can either embed the necessary code in a plugin, or as I prefer, modify the WordPress theme’s functions.php file.

Example Code

add_action('admin_notices', 'notifications');

/**
*
* notifications() - Administration Header Instructions and Notifications
*
*/
function notifications() {
global $current_screen;

if ($current_screen->id=='dashboard') ) {
echo "<div id='notice_dashboard' class='updated fade'><p>Welcome to your blog!</p></div>";
}
}

Welcome to your blog!

The code above shows a simple “Welcome to your blog!” if you are on the dashboard page. You can target other specific pages by changing the look-up on $current_screen->id to another value. You can use the reference table I created below.

Notice that I have added a unique css id identifier to the the <div>-tag. By doing this it I am able to style pages individually if I need to.

Read also  How To Check if the cURL PHP extension is loaded

Another example usage could be to remind authors to make sure they have chosen a category and tagged posts before they publish.


if ($current_screen-&amp;gt;id=='post') ) {
			echo &amp;quot;&amp;lt;div id='notice_post' class='updated fade'&amp;gt;&amp;lt;p&amp;gt;Please remember to choose both a CATEGORY and to TAG the post before you publish!&amp;lt;/p&amp;gt;&amp;lt;/div&amp;gt;&amp;quot;;
}

Reference Table

I created the following reference table to help other developers who want to create super targeted instructions in their WordPress installations.

Main MenuSubmenu$current_screen->id
Super Adminms-admin
Sitesms-sites
Usersms-users
Themesms-themes
Optionsms-options
Updatems-upgrade-network
Dashborddashboard
My Sitesmy-sites
Updatesupdate-core
Postsedit-post
Add Newpost
Categoriesedit-category
Post Tagsedit-post_tag
Media
Libraryupload
Add Newmedia
Links
Linkslink-manager
Add Newlink
Link Categoriesedit-link-categories
Pages
Pagesedit-page
Add Newpage
Commentsedit-comments
Appearance
Themes (Manage)themes
Themes (install)theme-install
Widgetswidgets
Menusnav-menus
Editortheme-editor
Plugins
Pluginsplugins
Add Newplugin-install
Editorplugin-editor
Users
Usersusers
Add Newuser
Your Profileprofile
Toolstools
Importimport
Exportexport
Networknetwork
Settings
Generaloptions-general
Writingoptions-writing
Readingoptions-reading
Discussionoptions-discussion
Mediaoptions-media
Privacyoptions-privacy
Permalinksoptions-permalink

Error: Please enter a valid email address

Error: Invalid email

Error: Please enter your first name

Error: Please enter your last name

Error: Please enter a username

Error: Please enter a password

Error: Please confirm your password

Error: Password and password confirmation do not match