Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6855999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:49:46+00:00 2026-05-27T01:49:46+00:00

I have a user based website with WordPress and from their profile settings they

  • 0

I have a user based website with WordPress and from their profile settings they are able to select the language, this info and other settings are set for every user in user_meta.

I know how to translate but, is there a way to set the theme language programmatically?

Thank you!

Edit: No plugins please, I need to do this as simple as possible.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:49:46+00:00Added an answer on May 27, 2026 at 1:49 am

    I found a different solution:

    // Set user selected language by loading the lang.mo file
    if ( is_user_logged_in() ) {
    
        // add local filter
        add_filter('locale', 'language');
    
        function language($locale) {
            /* Note: user_meta and user_info are two functions made by me,
               user_info will grab the current user ID and use it for
               grabbing user_meta */
    
            // grab user_meta "lang" value
            $lang = user_meta(user_info('ID', false), 'lang', false); 
    
            // if user_meta lang is not empty
            if ( !empty($lang) ) {
               $locale = $lang; /* set locale to lang */
            }
    
            return $locale; 
        }
    
        // load textdomain and .mo file if "lang" is set
        load_theme_textdomain('theme-domain', TEMPLATEPATH . '/lang');
    
    }
    

    Via: http://codex.wordpress.org/Function_Reference/load_theme_textdomain

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this URL: http://example.com/website/ then I check user country based on geoip and
I'm about to create a user based website and will have to store photo,
I have a website based on GAE and Python, and I'd like the user
I have a table that stores values each hour from a website based on
I'm setting up a group / user based security system. I have 4 tables
I have a web-based system built with user login data based on session variables.
I have a PHP script that creates other PHP files based on user input.
I have an view-based application where the user can do a lot of customization
I have the following requirement: Based on some user input, I need to generate
We have client server based app which saves user related data into a zip

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.