• Can you please check why this specific endpoint not work as soon as I enable WPML Multilingual plugin.

    	add_action(
    		'rest_api_init',
    		function () {
    			register_rest_route(
    				'wc/v3',
    				'/menu-names',
    				array(
    					'methods'  => 'GET',
    					'callback' => 'get_menu_names',
    					'permission_callback' => '__return_true',
    				)
    			);
    		}
    	);
    
            function get_menu_names() {
    
    		$nav_menu_locations = wp_get_nav_menus();
    		$result = [];
    		foreach((array)$nav_menu_locations as $item){
    			$result[$item->slug]=$item->term_id;
    		}
    		return( rest_ensure_response( $result ) );
    
    	}
  • The topic ‘Critical Error for specific custom Route’ is closed to new replies.