wp_ajax_delete_page() - WordPress 函数参考中文文档

返回介绍

wp_ajax_delete_page()

发布于 2017-09-11 字数1342 浏览 769 评论 0

wp_ajax_delete_page( string $action )

描述


参数

$action

(string)
(Required)


源代码

File: wp-admin/includes/ajax-actions.php

function wp_ajax_delete_page( $action ) {
	if ( empty( $action ) )
		$action = 'delete-page';
	$id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;

	check_ajax_referer( "{$action}_$id" );
	if ( !current_user_can( 'delete_page', $id ) )
		wp_die( -1 );

	if ( ! get_post( $id ) )
		wp_die( 1 );

	if ( wp_delete_post( $id ) )
		wp_die( 1 );
	else
		wp_die( 0 );
}

更新日志

Version 描述
3.1.0 Introduced.

相关函数

Uses

  • wp-includes/capabilities.php:
    current_user_can()
  • wp-includes/pluggable.php:
    check_ajax_referer()
  • wp-includes/functions.php:
    wp_die()
  • wp-includes/post.php:
    wp_delete_post()
  • wp-includes/post.php:
    get_post()

User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!