Admin-ajax.php 400 error in custom theme
It seems that you’re adding the AJAX action only if $pagenow (the current admin page/file) is edit.php or post.php, and that’s not going to work on admin-ajax.php, so you should instead add the action via the admin_init hook if you wish to add the action only on the admin side. E.g. add_action( ‘admin_init’, function () … Read more