0
私はすべての投稿と更新ID属性を繰り返し処理しようとしています。wp_remote_get。リクエストが実際に行われているようではありません。それはlocalhost上にあり、私は自分のローカルサーバに何も触れていません。 wp_remote_getがノンブロッキングなのか、それとも何か不足していますか?ここに私の機能があります:whileループでwp_remote_getが呼び出されない
function convert_to_postgres() {
$args = array(
'post_type'=>'post', //whatever post type you need to update
'numberposts'=>-1
);
$all_posts = get_posts($args);
foreach($all_posts as $post){
echo get_the_title($post);
echo "<br>";
if(have_rows('article_hotels', $post->ID)) {
while (have_rows('article_hotels', $post->ID)) : the_row();
$legacy_id = get_sub_field('tripcraft_hotel_id')['id'];
$url = get_option('tripcraft_widgets_hotel_master_url') . "/wordpress/hotels/legacy_id/{$legacy_id}";
$response = wp_remote_get($url);
$api_response = json_decode(wp_remote_retrieve_body($response), true);
echo get_sub_field('hotel_name');
echo "<br>";
echo "Legacy ID: " . $legacy_id;
echo "<br>";
echo "New ID: " . $api_response;
echo "<br>";
endwhile;
echo "<br>";
} else {
echo "No hotels found";
echo "<br>";
}
echo "<br>";
}
echo "<a href='options-general.php?page=plugin_hotel_id'>Back</a>";
}
何か助けていただければ幸いです。ありがとう!