Trouble with plugin development
-
Hey, I have this code:
add_action('plugins_loaded', 'check_language'); function check_language(){ $userid = wp_get_current_user()->ID; if(substr($_SERVER['REQUEST_URI'], 0, 6) == '/lang/'){ switch(substr($_SERVER['REQUEST_URI'], 6, 2)){ case 'en' : $language = 'english'; break; case 'fr' : $language = 'french'; break; default : $language = 'english'; break; } update_user_meta( $userid, 'language', $language ); } }
Now it’s in the plugin, but, it only ever stores french in the DB, can anyone see why this is? I am pulling my hair out cause I am surely missing something stupid.
I have 2 pages under the parent of ‘language’ which are english and french. The URLS are:
english: /lang/en/
french: /lang/fr/Thanks in advance.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Trouble with plugin development’ is closed to new replies.