I guess you are using Gutenberg in which case this is non-trivial problem.
Gutenberg saves post data in two steps (two separate http requests, just use developer tools in your browser to check). First, using REST API it saves Gutenberg-ready fields including title, content and slug. Problem is, REST API uses JSON and $_POST is empty array during this save ...
So, we figured out what it was.
In the options table (wp_options for some, we chose to do away with the wp prefix), there's a user_roles (or wp_user_roles value). One of the plugins we used (Yoast SEO in this case) had an update that zapped the value of that option, removing the Administrator role from that list. As a result, no admin could log into the ...
The problem is that, you have added extra white space before wp_ajax action. remove space from actions ' wp_ajax_my_action' and ' wp_ajax_nopriv_my_action'. because of extra space before ajax request, showing the 400 bad request error.
You should use :