How to override a non pluggable and non hookable function in a WordPress parent theme?

to redefine the AJAX action, you can try that

add_action(AE_Base::AJAX_PREFIX . "ae-profile-sync", function () {

    $profile_action = $GLOBALS["et_freelance"]->profile_action;


    // remove base action

    remove_action(
        AE_Base::AJAX_PREFIX . "ae-profile-sync"
        ,
        [
            $profile_action,
            "sync_post",
        ]
        , 10
    );


    // add new AJAX action

    add_action(
        AE_Base::AJAX_PREFIX . "ae-profile-sync"
        , function () {

            // new code here


        }
    );


}, 1); // priority 1 to launch this before the method sync_post

Leave a Comment