1. Go to this page and download the library: Download nolte/wp-endpoint library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nolte / wp-endpoint example snippets
use Nolte\AbstractEndpoint;
class customEndpoint extends AbstractEndpoint {
protected $endpoint = '/customEndpoint';
public function endpoint_callback( \WP_REST_Request $request ) {
$data = [
'data' => 'Hi',
'count' => 10,
'id' => $request->get_param( 'id' )
];
return $this->filter_data( $data );
}
public function endpoint_args() {
return [
'id' => [
'