How to send the featured image of a post to an API?

Here is an idea for sending a featured image (file data) on API and setting the image as a featured image on the server. Get File data from URL using following function: /*fetch the file from URL*/ function prefix_get_file_data_from_url( $url ) { $response = wp_remote_get( $url ); if ( is_array( $response ) && ! is_wp_error( … Read more

trigger WordPress rest any API call

There’s actually a hook that will fire for all REST API requests. It’s the recommended hook to use when adding your own API endpoints, so you can be sure that this hook will be fired for every single REST API request that your website handles. /** * @param \WP_REST_Server $wp_rest_server */ function capture_all_rest_api_requests( $wp_rest_server ) … Read more