Recently I updated our Motivational Quotes Site "TheQuotes.Net" to the latest version of Wordpress software.
After updating the Wordpress, the Admin user didn't see the links for managing the Quotes. We used below piece of code for showing those links only to the Admin.
if($_COOKIE['wordp_username'] == 'admin')
{
Show admin specific link
}
By analyzing the Cookies stored in the FireFox browser, I came to know that the latest version of the Wordpress is not using the cookie "wordp_username".
So, I decided to use the wordpress function "is_admin()". But his function didn't work for me.
After doing some Google search, I came to know about below piece of code.
if ( current_user_can('manage_options') )
{
Show admin specific links
}
Now the links are appearing for the Admins while hiding those links to other users.
You can subscribe to our Email posts, and you can bookmark this blog for further reading, or you can subscribe to our blog feed.
No comments:
Post a Comment