-
-
Save vielhuber/758904958aa559f62162df2e497fb856 to your computer and use it in GitHub Desktop.
| <?php | |
| if( !is_admin() && $pagenow != 'wp-login.php' && pll_current_language() == 'en' ) | |
| { | |
| wp_redirect(site_url().'/de/'); | |
| die(); | |
| } |
Hey, where can I apply these changes?
In
functions.phpof your active theme.
For some reason is not working on my website any chance it could be because I am using child theme?
Try to debug what exactly is not working. Does the first/second if clause work?
I am a bit newbie but to put that peace of code in functions.php you need to put it into a specific function, don't you?
@PatH007 not really 😁 PHP is a quirky language. Whatever is not in a function, is the 'main' code, even if it's spread across different files. I know it's weird, but that's how PHP works.
You could encapsulate it all in a function (more specifically, a procedure), if you really wanted to; but you would still have to call it afterwards, e.g.
function myProcedure() {
// put all you wish to do in here
return;
}
myProcedure();which, indeed, seems a bit overkill (function calls use up extra memory & resources, too!)
In
functions.phpof your active theme.