‘Sample Post Title’,
‘content’ => ‘Sample post content.’,
‘status’ => ‘publish’,
‘author’ => 1
);
$args = array(
‘method’ => ‘POST’,
‘headers’ => array(
‘Authorization’ => ‘Basic ‘ . base64_encode(‘VmlwbmF0ZTpsMUE1OUJ3KlA3MW9AckImWEBEQ0Y3Q3Fh’),
‘Content-Type’ => ‘application/json’
),
‘body’ => json_encode($data)
);
$response = wp_remote_request(‘https://homeinspectionstpaulmn.com/wp-json/wp/v2/posts’, $args);
if (is_wp_error($response)) {
// handle error
} else {
// handle success
}
?>