1
我只需要在远程站点上创建类别,同时在当前站点上创建类别。我使用了add_action('create_category','func_create_theme',10,2);动作钩子。如何在创建类别上使用xmlrpc调用?
函数func_create_theme()是通过ajax调用执行的。
谢谢
add_action('create_category', 'func_create_theme', 10, 2);
function func_create_theme($catId){
$category = get_category($catId);
$usr = 'upsol';
$pwd = 'change2';
$xmlrpc = 'http://localhost/~rocky/demo2/xmlrpc.php';
$client = new WP_HTTP_IXR_CLIENT($xmlrpc);
$postcontent = array(
'name' => $category->name,
'taxonomy' => 'category',
'slug' => $category->slug
);
$res = $client -> query('wp.newTerm',1, $usr, $pwd, $postcontent);
echo $postID = $client->getResponse();
}