Login_redirect hook not working

I have already used this hook in the same way described below, What could be going wrong?

class my_plugin {

    function __construct()

        var_dump(__LINE__); // run 
        add_filter('login_redirect', array($this, 'login_redirect'));

    function login_redirect()
        var_dump(__LINE__); // not run



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:

if (is_admin())
    // block 1
    // run admin classes
    // including my_plugin class
    // that includes login_redirect hook // WRONG!
    // block 2
    // run frontend classes

login_redirect hook does not run inside admin pages (is_admin() condition)

Solution: move login_redirect hook to frontend block

Need Your Help

How to Check Authenticity of an AJAX Request

javascript ajax security language-agnostic encryption

I am designing a web site in which users solve puzzles as quickly as they can. JavaScript is used to time each puzzle, and the number of milliseconds is sent to the server via AJAX when the puzzle is

'CloseToolhelp32Snapshot': identifier not found

c++ c windows visual-studio winapi

I am using a memory monitoring library based on "WIN32 tool help functions".