Roots Discourse

Redirection

Hi,
Is there anyway to redirect with data like in laravel ?

exemple

redirect('/')->with('status', 'Profile updated!');

Hi @Nickolas,

Unfortunately, the redirect() function from Laravel is not supported currently in the Sage but you can easily use wp_safe_redirect() or wp_redirect() functions for your needs.

Example:

$redirect_url = add_query_arg('status', urlencode('Profile updated!'), home_url('/'));
wp_safe_redirect($redirect_url, 307);

Hope that makes sense.

This topic was automatically closed after 42 days. New replies are no longer allowed.