最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugins - WPML - Hook when language is switched (change user language)

programmeradmin1浏览0评论

I would like to change the logged in user's language (if someone is logged in) when they change the language in front-end.

I'm using the WPML Multilingual CMS plugin in my Wordpress website.

I've tried to add this code in my custom plugin:

add_action('wpml_language_has_switched', 'change_user_language_in_database');

function change_user_language_in_database()
{
  die("test function");
}

The problem is that this function is always triggered. Also when the language isn't switched.

The version of WPML Multilingual CMS plugin is 4.2.7.1.

What am I doing wrong?

发布评论

评论列表(0)

  1. 暂无评论