WordPress ajax error 400 bad request for sending data to remote site [duplicate]
Your action name and hooks don’t match. You have hooked to _ajax_news in the hook name: add_action( ‘wp_ajax_nopriv_ajax_news’, ‘ajax_news’ ); add_action( ‘wp_ajax_ajax_news’, ‘ajax_news’ ); But the action you are sending in JavaScript is ajaxnews, without the underscore: ‘action’: ‘ajaxnews’, //calls wp_ajax_nopriv_ajaxnews See how your own comment has a different name than the actual hooks you’ve … Read more