We have a complicated weird system where we need to check if the wordpress administrator has logged in and by logged in i dont just mean the session but initial second when the query is sent to validate the credentials entered. I was thinking doing traditional php where I do something like the following:
if(isset($_POST['submit']) { // do something }
But that would be the incorrect way. Where exactly would i look to see this peice , i believe its wp-login.php but wasnt able to find what i was looking for.
thanks
try
or you can try :- http://codex.wordpress.org/Function_Reference/current_user_can
You can use very neat WordPress function to determine the user capabilities, it is called
current_user_can()
:<?php
if ( current_user_can('update_core') ) {
echo 'The current user is Administrator or Super administrator (in Multisite)';
}
Only Administrators of single site installations have the below list of capabilities. In Multi-site, only the Super Admin has these abilities:
See here for more information.
We can add some custom action inside the filter hook
login_redirect
. If the form was not submitted, the$user
param is a WP_Error Object.