Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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 =)