I have class:
class users{
public function __construct(){
add_action('do_redirect', 'redirect');
}
public function redirect(){
$url = get_site_url(null, '/welcome', 'https');
wp_redirect( $url );
exit;
}
public function some_function(){
do_action('do_redirect');
}
}
I get error :
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'redirect' not found or invalid function name.
If I use only wp_redirect()
i get error for headers.
How i must change this, because i fell I do something wrong?
users
class, or callingnew users()
?