JSON API and notification about registration

Set your query var notify to user (if you want to send an email to the user only) or both (if you want to send it to the user and the admin). Within the plugin controller/User.php:165 calls wp_new_user_notification with $_REQUEST[‘notify’]. wp_new_user_notification is (lucky you) a pluggable function. If you have your activation logic ready to … Read more

PHP error with a shortcode: “no suitable wrapper” for file_get_contents

Use the HTTP API: $http = wp_remote_get( ‘https://en.wikipedia.org/w/api.php?action=query&titles=Test_article&prop=revisions&rvlimit=1&format=json’ ); if ( ! $body = wp_remote_retrieve_body( $http ) ) return; if ( ! $data = json_decode( $body, true ) ) return; $date = new DateTime( $data[‘query’][‘pages’][‘746140638’][‘revisions’][0][‘timestamp’] ); return $date->format( ‘m-d-Y’ );

How to convert and use JSON data from a remote WordPress server?

On server B: $result = wp_remote_post(‘http://serverA.com/?api=json’, array( ‘method’ => ‘POST’, ‘redirection’ => 1, ‘httpversion’ => ‘1.0’, ‘blocking’ => true, ‘headers’ => array(), ‘body’ => array(), ‘cookies’ => array() )); if ( is_wp_error( $result ) ) { return ‘bad connection!’; } $json = $result[‘body’]; $posts = json_decode($json); Now you have $posts as usual php array. var_dump($posts) … Read more

How to clone all WordPress Rest API end points

There is nothing wrong if API returns more than what you need. Unless there is a security/privacy issue it is unlikely that the additional info will matter. If you totally can not live with core’s API, you need to just write your own. “cloning”, “forking” or any other nice term you might want to use … Read more