Skip to content
Advertisement

WordPress custom endpoint – rest_invalid_handler

I am completely new with PHP and WordPress, however I start to write my first plugin that should be able to expose a custom endpoint. I managed to register and activate the plugin and the route, but when I am trying to access this endpoint I am getting the following error:

JavaScript

If I access the: http://localhost/myWp/wp-json/myCustomPlugin/v2/ it looks like my endpoint is successfully registered:

JavaScript

and finally I am providing the code of my plugin:

JavaScript

I am using: WordPress 5.1.1 on Windows 10 XAMPP for Windows 7.3.3 Apache/2.4.38 (Win64) OpenSSL/1.1.1b PHP/7.3.3 mysqlnd 5.0.12-dev – 20150407

Thanks to All in advance!

Advertisement

Answer

try this

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement