Warning: Trying to access array offset on false in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 216
delete_user_meta() - 删除与用户匹配的meta数据 - WordPress函数 - WordPress动力
当前浏览:首页 / WordPress函数 / delete_user_meta()

delete_user_meta( int $user_id, string $meta_key, mixed $meta_value = '' )

删除与用户匹配的meta数据


Warning: Undefined array key -1 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 185

Warning: Undefined array key 3 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 186

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "687bd892cd80ff4ebec47400d42d3818" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "591e917b81604623af5097c0e38db548" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

deletemore...

user_meta 用户meta


描述

可以根据键或键和值进行匹配,基于键和值删除将阻止删除具有相同键的重复meta数据。如果需要,它还允许删除与key匹配的所有meta数据。


参数

$user_id

(int)(必填) 用户ID

$meta_key

(string)(必填) meta数据名称。

$meta_value

(mixed)(可选) meta数据值。如果提供,将仅删除与该值匹配的行。如果不是标量,则必须是可序列化的。

默认值: ''


返回

(bool) 成功时为true,失败时为false。



源码

查看源码 官方文档


更新日志

版本描述
3.0.0开始引入

使用示例

  • 示例1

    基本示例

    <?php
    if ( ! delete_user_meta($user_id, '_province') ) {
      echo "Ooops! Error while deleting this information!";
    }
    ?>