forked from hrsetyono/edje-wp-library
-
Notifications
You must be signed in to change notification settings - Fork 0
Helper Functions
Henner S edited this page Mar 27, 2023
·
1 revision
H::GET( $url, <$params> )
H::POST( $url, <$params> )
PARAMETERS
-
$url (string) - API Endpoint.
-
$params (array, optional) - Extra data
EXAMPLE
$result = H::GET( 'https://your-site.com/wp-json/wp/v1/sample-get/322' );If most of your endpoints are from the same site, define a constant called API_URL. Now you can pass in only the relative path:
// wp-config.php
...
define( 'API_URL', 'https://your-site.com/wp-json/wp/v1' );$result = H::GET( '/sample-get/322' );
H::POST( '/sample-post/322', [
'name' => 'hrsetyono',
'website' => 'pixelstudio.id'
] );