php - 将 post_category 添加到 PHP XMLRPC
问题描述
我试图弄清楚如何将 post_category 添加到 XMLRPC 使用“PHPXMLRPC”创建的新帖子中。
我有以下代码:
$message = new xmlrpcmsg(
$function_name,
array(
new xmlrpcval(0, "int"),
new xmlrpcval($username, "string"),
new xmlrpcval($password, "string"),
new xmlrpcval(
array(
"post_type" => new xmlrpcval("post", "string"),
"post_status" => new xmlrpcval("publish", "string"),
"post_title" => new xmlrpcval($article_title, "string"),
"post_category" => new xmlrpcval(array( 'Cars' => 12 ),"int"),
"post_author" => new xmlrpcval(1, "int"),
"post_content" => new xmlrpcval($new_article, "string")
),
"struct"
)
)
);
对于“post_category”,我尝试了很多方法:
"post_category" => new xmlrpcval('Cars'),"int"),
"post_category" => new xmlrpcval('Cars'),"string"),
"post_category" => new xmlrpcval(array( 'Cars' => 12 ),"array"),
"post_category" => new xmlrpcval(array( 'Cars' => 12 ),"int"),
"post_category" => new xmlrpcval(12),"int"),
以及我能想到的所有其他变化。任何人都可以帮我添加类别(最好通过 NAME,而不是 ID,因为 ID 是未知的)?
解决方案
推荐阅读
- python - 错误:AttributeError:“WebElement”对象在使用 Python 的 Selenium 中没有属性“Clear”
- firebase - 在 Flutter / Dart 的工厂函数中运行异步代码
- reactjs - 如何获取自定义 React/React-Native 组件的参数和类型定义
- python - Discord.py 获取没有机器人的服务器成员
- r - R 中的 Vemco 声学遥测数据(vrl 文件)
- excel - 将 Workbook_1 中的值记录到 Workbook_2
- typescript - 如何使打字稿在失败的非空断言上抛出运行时错误?
- r - 在某些条件下转换向量中的矩阵值
- jquery - toggleClass 单击或更改子输入
- html - 开发 FlexdashBoard 应用程序时如何在 renderUI 中结合数据表和 HTML。?