时间:2024-03-09
WordPress函数delete_post_meta用于删除文章元数据。
delete_post_meta( int $post_id, string $meta_key, mixed $meta_value = '' )
$post_id
整数
文章ID
$meta_key
字符串
键名称
$meta_value
字符串
值
$allposts = get_posts( 'numberposts=-1&post_type=post&post_status=any' ); foreach( $allposts as $postinfo ) { delete_post_meta( $postinfo->ID, 'views' ); }
delete_post_meta()函数位于:wp-includes/post.php
相关函数:
add_metadata()
get_post_meta()
add_post_meta()
update_post_meta()
Copyright © 2019-2024 1234.club