Viewable by Admin Only

This article will show you how to make a WordPress Page viewable by the admin only. This is really quite handy if you’re creating a custom WordPress Template. You can make certain parts or the entire page viewable by the admin only by placing the code below in your WordPress Page Template.

if ( current_user_can( 'manage_options' ) ) {
    // display text here for user with admin privilege
} else {
    // display text here for user without admin privilege

There has been some confusion whether to use is_admin() instead of current_user_can(‘manage_options’). is_admin() is a conditional to check if the user is in the Dashboard or in the Administration Panel. It’s just a boolean conditional that will return true if the URL being accessed is in the admin section.

if ( is_admin() ) {
    // returns true that user is in the admin panel
} else {
    // returns false if otherwise

It’s best to use current_user_can(‘manage_options’) when checking if user is an admin.

Change WordPress Password

One of the worst things that could happen to your blog is losing your login credentials. It’s a rare event, but it does happen occasionally. This is particularly true if you run hundreds of blogs and websites. Keeping track of all usernames and passwords can be a bit of a challenge.

If you have forgotten your WordPress password, you can quickly recover it, by using the “Lost your password” link underneath the login form. In my case, WordPress mail was not working. So, not only I can’t remember my password, but I also can’t send out lost passwords via email.

Thankfully, I had access to PHPMyadmin, a MySQL database administration tool.

Log in to PHPMyadmin. Access the WordPress database and look for the wp_users table. Edit the admin user and change the “user_pass” field. The WordPress password field uses the MD5 encryption instead of being in the clear.


Save your changes. Log in to WordPress.