301 Redirection After Comment

Question

The below code redirects visitors to any page that you want.

// Redirect to thank you post after comment
add_action('comment_post_redirect', 'redirect_to_thank_page');
function redirect_to_thank_page() {
    return 'https://example.com/thank-you';
}

However, I use WP Multisite feature and the same active theme is used by all subsites in the network. So can I redirect visitors according to the subsite which they visit?

i.e. if you leave a comment on example.com/fr, then you’ll be redirected automatically to example.com/fr/thank-you page.

If we use blog-id or subdirectory name in the above snippet, it might help?

WP Multisite method: subdirectory

Regards.

--------------------------------------------------

>>> Share a link to this question, just copy and paste the code bellow on your web page <<<

<a href="https://www.wptricks.com/question/301-redirection-after-comment/">

301 Redirection After Comment</a>
0
, , , Serdar Kocak 1 month 0 Answers 22 views 0

Leave an answer