久久精品水蜜桃av综合天堂,久久精品丝袜高跟鞋,精品国产肉丝袜久久,国产一区二区三区色噜噜,黑人video粗暴亚裔

編輯“WordPress:Function Reference/delete post meta

跳轉(zhuǎn)至: 導(dǎo)航、? 搜索
警告:您沒有登錄。如果您做出任意編輯,您的IP地址將會公開可見。如果您登錄創(chuàng)建一個賬戶,您的編輯將歸屬于您的用戶名,且將享受其他好處。

該編輯可以被撤銷。 請檢查下面的對比以核實您想要撤銷的內(nèi)容,然后發(fā)布下面的更改以完成撤銷。

最后版本 您的文本
第1行: 第1行:
==Description==
==描述==
==描述==
This function deletes all custom fields with the specified key from the specified post. See also [[WordPress:Function Reference/update post meta|update_post_meta()]], [[WordPress:Function Reference/get post meta|get_post_meta()]] and [[WordPress:Function Reference/add post meta|add_post_meta()]].


函數(shù)用某篇文章特別規(guī)定的key,刪除所有的自定義區(qū)。也看看[[WordPress:Function Reference/update post meta|update_post_meta()]], [[WordPress:Function Reference/get post meta|get_post_meta()]] 和 [[WordPress:Function Reference/add post meta|add_post_meta()]]。
函數(shù)用某篇文章特別規(guī)定的key,刪除所有的自定義區(qū)。也看看[[WordPress:Function Reference/update post meta|update_post_meta()]], [[WordPress:Function Reference/get post meta|get_post_meta()]] 和 [[WordPress:Function Reference/add post meta|add_post_meta()]]。
==Usage==


==用法==
==用法==


%%% <?php delete_post_meta($post_id, $key, $value); ?> %%%
%%% <?php delete_post_meta($post_id, $key, $value); ?> %%%
%%% <?php delete_post_meta($post_id, $key, $value); ?> %%%
==Examples==
===Default Usage===


==例子==
==例子==
===默認用法===
===默認用法===
<?php delete_post_meta(76, 'my_key', 'Steve'); ?>


<?php delete_post_meta(76, 'my_key', 'Steve'); ?>
<?php delete_post_meta(76, 'my_key', 'Steve'); ?>
===Other Examples===


===其它的例子===
===其它的例子===
Let's assume we had a plugin that added some meta values to posts, but now when we are uninstalling the plugin, we want to delete all the post meta keys that the plugin added. Assuming the plugin added the keys <tt>related_posts</tt> and <tt>post_inspiration</tt>.


假如我們有一個插件,這個插件可以向文章添加一些meta參數(shù)值,但是當我們卸載插件的時候,我們想要刪除插件添加的所有的文章 meta keys。假定插件添加keys<tt>related_posts</tt> 和<tt>post_inspiration</tt>。
假如我們有一個插件,這個插件可以向文章添加一些meta參數(shù)值,但是當我們卸載插件的時候,我們想要刪除插件添加的所有的文章 meta keys。假定插件添加keys<tt>related_posts</tt> 和<tt>post_inspiration</tt>。
To delete all the keys, this would be added to the "uninstall" function:


要刪除所有的keys,需要將下面的內(nèi)容添加到"卸載"函數(shù):
要刪除所有的keys,需要將下面的內(nèi)容添加到"卸載"函數(shù):
<pre><?php
<pre><?php
?? $allposts = get_posts('numberposts=0&post_type=post&post_status=');
?? $allposts = get_posts('numberposts=0&post_type=post&post_status=');
第25行: 第46行:
?? }
?? }
?></pre>
?></pre>
<pre><?php
? $allposts = get_posts('numberposts=0&post_type=post&post_status=');
? foreach( $allposts as $postinfo) {
? ? delete_post_meta($postinfo->ID, 'related_posts');
? ? delete_post_meta($postinfo->ID, 'post_inspiration');
? }
?></pre>
Or, if you wanted to delete all the keys except where <tt>post_inspiration</tt> was "Sherlock Holmes":


或者,如果你想要刪除除了<tt>post_inspiration</tt>是"Sherlock Holmes"之外的所有的keys:
或者,如果你想要刪除除了<tt>post_inspiration</tt>是"Sherlock Holmes"之外的所有的keys:
第41行: 第76行:
?></pre>
?></pre>


<pre><?php
? $allposts = get_posts('numberposts=0&post_type=post&post_status=');
? foreach( $allposts as $postinfo) {
? ? delete_post_meta($postinfo->ID, 'related_posts');
? ? $inspiration = get_post_meta( $postinfo->ID, 'post_inspiration );
? ? foreach( $inspiration as $value ) {
? ? ? if( $value != "Sherlock Holmes" )
? ? ? ? delete_post_meta($postinfo->ID, 'post_inspiration', $value);
? ? }
? }
?></pre>
Or maybe post number 185 was just deleted, and you want to remove all <tt>related_posts</tt> keys that reference it:


或者可能文章數(shù)字185已經(jīng)刪除了,而且你想要刪除所有提及這個數(shù)字的<tt>related_posts</tt> keys:
或者可能文章數(shù)字185已經(jīng)刪除了,而且你想要刪除所有提及這個數(shù)字的<tt>related_posts</tt> keys:
第51行: 第104行:
?? }
?? }
?></pre>
?></pre>
<pre><?php
? $allposts = get_posts('numberposts=0&post_type=post&post_status=');
? foreach( $allposts as $postinfo) {
? ? delete_post_meta($postinfo->ID, 'related_posts', '185');
? }
?></pre>
For a more detailed example, go to the [[WordPress:Function Reference/post meta Function Examples|post_meta Functions Examples]] page.


更詳細的例子,請進入[[WordPress:Function Reference/post meta Function Examples|post_meta函數(shù) 例子]]網(wǎng)頁。
更詳細的例子,請進入[[WordPress:Function Reference/post meta Function Examples|post_meta函數(shù) 例子]]網(wǎng)頁。
'''''Note:''' Unlike [[WordPress:Function Reference/update post meta|update_post_meta()]], This function will delete '''all''' fields that match the criteria.''


'''''注:'''與[[WordPress:Function Reference/update post meta|update_post_meta()]]不同,這個函數(shù)會刪除匹配標準的'''所有的'''區(qū)。
'''''注:'''與[[WordPress:Function Reference/update post meta|update_post_meta()]]不同,這個函數(shù)會刪除匹配標準的'''所有的'''區(qū)。
==Parameters==
==參數(shù)==
==參數(shù)==
{{Parameter|$post_id|integer|The ID of the post from which you will delete a field.}}


{{Parameter|$post_id|integer|你刪除某個區(qū)所在文章的ID。}}
{{Parameter|$post_id|integer|你刪除某個區(qū)所在文章的ID。}}
{{Parameter|$key|string|The key of the field you will delete.}}


{{Parameter|$key|string|你將要刪除某個區(qū)的key。}}
{{Parameter|$key|string|你將要刪除某個區(qū)的key。}}
{{Parameter|$value|string|The value of the field you will delete. This is used to differentiate between several fields with the same key. If left blank, all fields with the given key will be deleted.|optional}}


{{Parameter|$value|string|你將要刪除的某個區(qū)的參數(shù)值。這個參數(shù)值是用來區(qū)分幾個具有相同的key的區(qū)。如果這個參數(shù)值是空的,那么某個key的所有區(qū)都會被刪除。|可選擇的}}
{{Parameter|$value|string|你將要刪除的某個區(qū)的參數(shù)值。這個參數(shù)值是用來區(qū)分幾個具有相同的key的區(qū)。如果這個參數(shù)值是空的,那么某個key的所有區(qū)都會被刪除。|可選擇的}}
==Related==


==相關(guān)的==
==相關(guān)的==
[[WordPress:Function Reference/update post meta|update_post_meta()]], [[WordPress:Function Reference/get post meta|get_post_meta()]], [[WordPress:Function Reference/add post meta|add_post_meta()]], [[WordPress:Function Reference/get post custom|get_post_custom()]], [[WordPress:Function Reference/get post custom values|get_post_custom_values()]], [[WordPress:Function Reference/get post custom keys|get_post_custom_keys()]]
[[WordPress:Function Reference/update post meta|update_post_meta()]], [[WordPress:Function Reference/get post meta|get_post_meta()]], [[WordPress:Function Reference/add post meta|add_post_meta()]], [[WordPress:Function Reference/get post custom|get_post_custom()]], [[WordPress:Function Reference/get post custom values|get_post_custom_values()]], [[WordPress:Function Reference/get post custom keys|get_post_custom_keys()]]
[[WordPress:Function Reference/update post meta|update_post_meta()]], [[WordPress:Function Reference/get post meta|get_post_meta()]], [[WordPress:Function Reference/add post meta|add_post_meta()]], [[WordPress:Function Reference/get post custom|get_post_custom()]], [[WordPress:Function Reference/get post custom values|get_post_custom_values()]], [[WordPress:Function Reference/get post custom keys|get_post_custom_keys()]]
請注意,您對站長百科的所有貢獻都可能被其他貢獻者編輯,修改或刪除。如果您不希望您的文字被任意修改和再散布,請不要提交。
您同時也要向我們保證您所提交的內(nèi)容是您自己所作,或得自一個不受版權(quán)保護或相似自由的來源(參閱Wordpress-mediawiki:版權(quán)的細節(jié))。 未經(jīng)許可,請勿提交受版權(quán)保護的作品!
取消 編輯幫助(在新窗口中打開)

本頁使用的模板: