代码之家  ›  专栏  ›  技术社区  ›  aviv

提交日志时通过xmlrpc api在wordpress中设置日志标记?

  •  0
  • aviv  · 技术社区  · 16 年前

    我正试图通过xmlrpc使用wordpress api提交新文章。但是我不能设置post标签(也不能设置类别)。

            echo "Adding $term to blog via XMLRPC ...";
            $client = new IXR_Client("http://$blog.wordpress.com/xmlrpc.php");
            $content = array('title'=>$term,
                             'description'=>"All about $term",
                             'category'=>'barvaz,moshe',
                              'tags'=>'tag1,tag2');
            $client->query('metaWeblog.newPost', 0, $username, $password, $content, true);
            $rv = $client->getResponse();
            print_r($rv);
    

    知道吗?

    2 回复  |  直到 15 年前
        1
  •  3
  •   redleaffly    16 年前
    $categories[0]="cate1";
    $categories[1]="cate2";
    
    $tags[0]="tag1";
    $tags[1]="tag2";
    
    
    ...
    $content['title'] = $title;
    $content['categories'] = $categories;
    $content['mt_keywords'] = $tags;
    $content['description'] = $description; 
    

    更多电子邮件:cn.xiaowen@gmail.com

        2
  •  1
  •   theChrisKent    15 年前

    您也可以这样设置自定义字段

    $content['custom_fields'] = array(
            array('key' => 'Image', 'value' => $img),
            array('key' => '_aioseop_keywords', 'value' => $aiokey),
            array('key' => '_aioseop_title', 'value' => $title),
        );