Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress How to Build a WordPress Plugin Building WordPress Widgets, and Shortcodes Adding AJAX To Plugins on the Front-End: Part 2

Please help, getting "POST http://custom-plugin.test/wp-admin/admin-ajax.php 400 (Bad Request)", not working in 2018

Is anyone else having trouble with this is 2018?

I have replaced my own code with the code from the downloadable example files, and it still isn't working. I even replaced my entire plugin folder with the example plugin folder, with the same results.

In my Chrome dev tools console I get "POST http://custom-plugin.test/wp-admin/admin-ajax.php 400 (Bad Request)".

I am not seeing the console.log message when I refresh, and my 'last_updated' value isn't updating in the database. Not sure if this just isn't working anymore since this course is a few years old now. Everything else up till now I've been able to get to work. Has anyone else gotten this to work recently?

Any help would be much appreciated!

1 Answer

Cedric Clifford Lajato
Cedric Clifford Lajato
2,033 Points

Hi Matt - If you can share your code then I can help you to figure it out =)