Php 在Wordpress中创建标记后获取标记名和标记段塞

Php 在Wordpress中创建标记后获取标记名和标记段塞,php,wordpress,Php,Wordpress,在Wordpress中创建标记后,我想获得标记名和标记slug 我已经在function.php中完成了这项工作,但它只在$tags中返回“post_tag”,我需要在返回时或通过任何其他方法创建标记名和slug 感谢您的任何帮助 function update_tags($tags) { $data = array("name" => $tags->name,"slug" => $tags->slug,); $data_string = json_e

在Wordpress中创建标记后,我想获得标记名标记slug

我已经在
function.php
中完成了这项工作,但它只在
$tags
中返回
“post_tag”
,我需要在返回时或通过任何其他方法创建标记名和slug

感谢您的任何帮助

function update_tags($tags) {
    $data = array("name" => $tags->name,"slug" => $tags->slug,); 

    $data_string = json_encode($data);                                                                                   

    $ch = curl_init('APIURL');                                                                      
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                     
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);                                                                  
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                                                                      
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
        'Content-Type: application/json',                                                                                
        'Content-Length: ' . strlen($data_string))                                                                       
    );                                                                                                                   

    $result = curl_exec($ch);
}
add_action( 'post_tag_add_form', 'update_tags',10 ,1 );