wp_ajax action responds with 0
Change your wp_localize_script-Call to the right Action: wp_localize_script( ‘addItemToNav’, ‘menuItems’, array( // URL to wp-admin/admin-ajax.php to process the request ‘ajaxurl’ => admin_url( ‘admin-ajax.php’ ), // generate a nonce with a unique ID “myajax-post-comment-nonce” ‘postCommentNonce’ => wp_create_nonce( ‘update_nav_items-nonce’ ), ‘action’ => ‘wp_ajax_update_nav_items’ ) ); As ‘action’ you currently Input the function Name, but that is wrong. … Read more