Skip to content

Instantly share code, notes, and snippets.

@willybahuaud
Created November 18, 2014 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willybahuaud/0382401b87c7ab4c6eb5 to your computer and use it in GitHub Desktop.
Save willybahuaud/0382401b87c7ab4c6eb5 to your computer and use it in GitHub Desktop.
translate wpm ajax requests
<?php
add_action( 'plugins_loaded', function() {
global $sitepress;
if( ! isset( $_REQUEST['icl_ajx_action'] ) && isset( $_POST[ 'mylang' ] ) ) {
$reflection = new ReflectionClass( 'SitePress' );
$admin_language = $reflection->getProperty( 'admin_language' );
$admin_language->setAccessible( true );
$admin_language->setValue( $sitepress, $_POST[ 'mylang' ] );
}
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment