wp_insert_post 不在设备上保存自定义分类

wp_insert_post not saving custom taxonomy on devices

我在我的 wordpress 网站上遇到了一个奇怪的问题。

我在前端使用 wp_insert_post 来保存自定义 post 类型及其自定义分类。在 PC 上它完美地保存了自定义分类法,但是当我尝试在移动设备或 ipad 上提交时,它没有保存它。

这是我的代码:

$post = array(
    'post_title'=>$_POST['message_title'],
    'post_status'=>'pending',
    'post_type'=>'mondd_el',
    'tax_input'=>array('me_kategoria'=>$cat_id),
    'post_content'=>$_POST['my_message']
);

$postid = wp_insert_post($post);

谢谢

您确定当前用户有能力使用分类法吗?请检查...这是您从 WORDPRESS 文档中获得的内容

"tax_input: Equivalent to calling wp_set_post_terms() for each custom taxonomy in the array. If the current user doesn't have the capability to work with a taxonomy, then you must use wp_set_object_terms() instead."