Yes, when i put the code in a plugin, then works.
Thanks!
—
P.S. You say “Since you are quoting Google, I will too:”
Your link is only a blogpost link (ok from Google). However, the code 302 is not the principal subject of the article. I think that in your blogpost link the author not has well considered what redirect is the best. ??
My link is the official Search Console Help and the subject of the article is the 301 redirect
And whether 302 or 301 is technical correct, this is not the question for me. For the most (ok, not all) SEOs is a best practice to use 301 redirects.
And my own experience and tests says that’s 301 redirect are for SEO reasons better den 302 redirects.
I think the best solutions for Plugin developers would be to offer an option, so that the user can set 301 or 302.
For me: I have now the solution. In a plugin the code above works fine ??
—
P.S.S. Your Plugin is very good. I am very happy with it also with 302 code ??