WordPress REST endpoint not able to reach with jQuery
First, lets fix your endpoint: function wpc_ylp_rest_videos( ) { $myObj->name = “John”; $myObj->age = 30; $myObj->city = “New York”; $myJSON = json_encode($myObj); echo $myJSON; } There are a few problems here: callbacks for REST API endpoints are meant to return their data, like shortcodes. The REST API does the JSON encoding, you’re not meant to … Read more