Wordpress 发布帖子时如何将php代码作为内容传递

Wordpress 发布帖子时如何将php代码作为内容传递,wordpress,custom-wordpress-pages,Wordpress,Custom Wordpress Pages,我正在解析JSON数据,并希望在Wordpress帖子中显示它。下面是我想发布的代码。你知道我怎么能在wp_insert_post中包含这个吗 $url = "http://metaweather.com/api/location/2379574"; $json = file_get_contents($url); $json_data = json_decode($json, true); $weather_sate=$json_data['consolidated_wea

我正在解析JSON数据,并希望在Wordpress帖子中显示它。下面是我想发布的代码。你知道我怎么能在wp_insert_post中包含这个吗

$url = "http://metaweather.com/api/location/2379574";
$json = file_get_contents($url);
$json_data = json_decode($json, true);
$weather_sate=$json_data['consolidated_weather'][0][weather_state_name]
$temperature=$json_data['consolidated_weather'][0][the_temp]

是否要将数据插入特定的帖子?还是要使用json数据创建新帖子?@Ruvee我要使用json数据创建新帖子。