最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to update post meta with xml data

programmeradmin9浏览0评论

I am trying to get this to work, but it doesn't. What is wrong?

$tutorgeocodesrc = "=" . urlencode($tutoraddressfull) . "&appid=...";
$tutorgeocode    = simplexml_load_file($tutorgeocodesrc);
$tutorlat        = $tutorgeocode->Result[0]->latitude;
$tutorlng        = $tutorgeocode->Result[0]->longitude;
foreach($tutorgeocode->Result[0]->latitude as $child) 
{
    update_post_meta($user_id, 'tutorcords', $tutorlat);
}

I am trying to get this to work, but it doesn't. What is wrong?

$tutorgeocodesrc = "http://where.yahooapis/geocode?location=" . urlencode($tutoraddressfull) . "&appid=...";
$tutorgeocode    = simplexml_load_file($tutorgeocodesrc);
$tutorlat        = $tutorgeocode->Result[0]->latitude;
$tutorlng        = $tutorgeocode->Result[0]->longitude;
foreach($tutorgeocode->Result[0]->latitude as $child) 
{
    update_post_meta($user_id, 'tutorcords', $tutorlat);
}
Share Improve this question edited Aug 8, 2012 at 15:01 fuxia 107k39 gold badges255 silver badges459 bronze badges asked Aug 8, 2012 at 14:41 WernerWerner 1 0
Add a comment  | 

1 Answer 1

Reset to default 0

On which hook of WP init this code part?

$user_id - why and from how is this var value? update_post_meta() will use the post ID, see Codex.

发布评论

评论列表(0)

  1. 暂无评论