• Hey,

    Just updated to the latest version a few days ago and the menu is not switching anymore.

    I’m using the latest version, 2 languages set, each has it’s own menu.

    Here is a simple example I’ve made with Twenty Twelve theme:

    PHP:

    function test_load_menu_callback()
    {
    	wp_nav_menu(array('container' => FALSE, 'theme_location' => 'primary'));
    	die();
    }
    add_action('wp_ajax_load_menu', 'test_load_menu_callback');
    add_action('wp_ajax_nopriv_load_menu', 'test_load_menu_callback');

    JS:

    jQuery(document).ready(function($){
    	$('body').on('click', 'a', function(e){
    		e.preventDefault();
    
    		var data = {
    			action: 'load_menu',
    			pll_load_front: true
    		};
    
    		$.ajax({
    			type: 'POST',
    			url: ajax_object.ajax_url,
    			data: data,
    			cache: false,
    			dataType: 'json',
    		}).done(function(response){
    			console.log(response);
    		});
    	});
    });

    In the version 1.0.4 the result was that the menu was switched to the other language. In the current version, running the same code the result is the same menu as it is, meaning that it does not switch the language.

    What to do?

    http://wordpress.org/extend/plugins/polylang/

Viewing 1 replies (of 1 total)
  • Plugin Author Chouby

    (@chouby)

    I am not sure I understand what you want to do. But in any case, if you don’t specify the parameter ‘lang’ in your data, Polylang will always load the language of the page beeing diplayed. It was the same in 1.0.4

Viewing 1 replies (of 1 total)

The topic ‘Ajax, menu switch not working’ is closed to new replies.