• 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細

このWikiはいつでも誰でも編集できます

関数リファレンス/wp delete post

提供: WordPress Codex 日本語版
< 関数リファレンス
2010年5月2日 (日) 19:25時点におけるKz (トーク | 投稿記録)による版 (en:Function_Reference/wp_delete_post 14:20, 1 January 2010 Aesqe)

(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索

Description

Removes a post, attachment, or page.

When the post and page goes, everything that is tied to it is deleted also. This includes comments, post meta fields, and terms associated with the post.

Usage

%%%<?php wp_delete_post( $postid, $force_delete = false ) ?>%%%

Parameters

$postid
integer) (optional) Post ID.
初期値: 0
$force_delete
bool) (optional) Whether to bypass trash and force deletion (added in WordPress 2.9).
初期値: false

Return Values

(mixed) 
False on failure.

Examples

Delete Post

Deleting WP default post "Hello World" which ID is '1'.

<?php wp_delete_post(1); ?>

Notes

  • Uses: do_action() on 'delete_post' before deletion unless post type is 'attachment'.
  • Uses: do_action() on 'deleted_post' after deletion unless post type is 'attachment'.
  • Uses: wp_delete_attachment() if post type is 'attachment'.
  • Uses global: (object) $wpdb
  • Uses global: (object) $wp_rewrite

Change Log

Since: 1.0.0

Source File

wp_delete_post() is located in wp-includes/post.php.

Related

wp_update_post(), wp_delete_attachment(), wp_get_attachment_url(), wp_insert_attachment(), wp_insert_post()

最新英語版: WordPress Codex » 14:20, 1 January 2010 Aesqe最新版との差分