text($content_md); $data = [ 'title' => $yaml['name'] ?? 'Kein Titel', 'content' => $html, 'status' => 'publish', 'excerpt' => $yaml['description'] ?? '', 'slug' => $yaml['url'] ?? '', ]; $response = wp_rest_post($data); echo "\n✅ Beitrag ID: " . ($response['id'] ?? 'Fehler'); function wp_rest_post($data) { $url = 'http://markdownimport.local/wp-json/wp/v2/posts'; $username = 'wpadmin'; $password = 'CZOm Nsa4 Gptt HS8c UVbl qSuK'; $auth = base64_encode("$username:$password"); $options = [ 'http' => [ 'method' => 'POST', 'header' => "Authorization: Basic $auth\r\nContent-Type: application/json\r\n", 'content' => json_encode($data), ] ]; $context = stream_context_create($options); $result = file_get_contents($url, false, $context); return json_decode($result, true); }