I have already used this hook in the same way described below, What could be going wrong?
class my_plugin {
function __construct()
{
parent::__construct();
var_dump(__LINE__); // run
add_filter('login_redirect', array($this, 'login_redirect'));
}
function login_redirect()
{
var_dump(__LINE__); // not run
}
}
EDIT 1
This hook run after successfully login processes. As I said I have used this hook in another plugins. The question is What could cause this malfunction?
Ok, got it.
For the record:
It is sure that could helps someone else. Indeed time ago I suffered a problem triggered by the same reason:
is_admin()incorrect use:My starter code is:
login_redirecthook does not run inside admin pages (is_admin()condition)Solution: move login_redirect hook to frontend block