1
J'ai juste besoin de créer une catégorie sur un site distant tout en créant la catégorie sur le site actuel. J'ai utilisé l'add_action ('create_category', 'func_create_theme', 10, 2); crochet d'action.Comment utiliser appel xmlrpc sur créer une catégorie?
La fonction func_create_theme() a été exécutée via un appel ajax.
Merci
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();
}