I use a PHP function which gets the current URL for a WordPress plugin:

$current_url = home_url(add_query_arg(array(),$wp->request));

If I then add $current_url to a href link, it will redirect to the current page. However, I want to add another link in front of the redirect (in front of the PHP code).

So if you are on
test.com/page123

I want it to redirect to :
test.com/redirect/https://test.com/page123

So I basically want to add test.com/redirect/ in front of it.

How can I add this to the PHP code?

Read more here: Add extra URL in front of PHP function for redirect – PHP


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: