本文整理汇总了PHP中wp_untrash_post_comments函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_untrash_post_comments函数的具体用法?PHP wp_untrash_post_comments怎么用?PHP wp_untrash_post_comments使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_untrash_post_comments函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wp_untrash_post
/**
* Restores a post or page from the Trash
*
* @since 2.9.0
* @uses do_action() on 'untrash_post' before undeletion
* @uses do_action() on 'untrashed_post' after undeletion
*
* @param int $post_id Post ID.
* @return mixed False on failure
*/
function wp_untrash_post($post_id = 0)
{
if (!($post = wp_get_single_post($post_id, ARRAY_A))) {
return $post;
}
if ($post['post_status'] != 'trash') {
return false;
}
do_action('untrash_post', $post_id);
$post_status = get_post_meta($post_id, '_wp_trash_meta_status', true);
$post['post_status'] = $post_status;
delete_post_meta($post_id, '_wp_trash_meta_status');
delete_post_meta($post_id, '_wp_trash_meta_time');
wp_insert_post($post);
wp_untrash_post_comments($post_id);
do_action('untrashed_post', $post_id);
return $post;
}
示例2: untrashed_post_comments
public function untrashed_post_comments($post_id)
{
wp_untrash_post_comments($post_id);
}
示例3: wp_untrash_post
/**
* Restore a post or page from the Trash.
*
* @since 2.9.0
*
* @param int $post_id Optional. Post ID. Default is ID of the global $post.
* @return WP_Post|false WP_Post object. False on failure.
*/
function wp_untrash_post($post_id = 0)
{
if (!($post = get_post($post_id, ARRAY_A))) {
return $post;
}
if ($post['post_status'] != 'trash') {
return false;
}
/**
* Fires before a post is restored from the trash.
*
* @since 2.9.0
*
* @param int $post_id Post ID.
*/
do_action('untrash_post', $post_id);
$post_status = get_post_meta($post_id, '_wp_trash_meta_status', true);
$post['post_status'] = $post_status;
delete_post_meta($post_id, '_wp_trash_meta_status');
delete_post_meta($post_id, '_wp_trash_meta_time');
wp_insert_post(wp_slash($post));
wp_untrash_post_comments($post_id);
/**
* Fires after a post is restored from the trash.
*
* @since 2.9.0
*
* @param int $post_id Post ID.
*/
do_action('untrashed_post', $post_id);
return $post;
}
示例4: process_bulk_action
//.........这里部分代码省略.........
$user->remove_role('frontend_vendor');
$user->remove_cap('fes_is_admin');
$user->add_role('subscriber');
// remove all their posts
$args = array('post_type' => 'download', 'author' => $id, 'posts_per_page' => -1, 'fields' => 'ids', 'post_status' => 'any');
$query = new WP_Query($args);
foreach ($query->posts as $id) {
wp_delete_post($id, false);
}
$subject = apply_filters('fes_application_revoked_message_subj', __('Application Revoked', 'edd_fes'), 0);
$message = EDD_FES()->helper->get_option('fes-vendor-app-revoked-email', '');
EDD_FES()->emails->send_email($user->user_email, $from_name, $from_email, $subject, $message, "user", $id, array('fes-vendor-app-revoked-email-toggle'));
do_action('fes_revoke_vendor_admin', $id);
}
if ('decline_vendor' === $current_action) {
if ($id < 2) {
break;
}
if (user_can($id, 'fes_is_admin') || user_can($id, 'frontend_vendor')) {
break;
}
if (!user_can($id, 'pending_vendor')) {
break;
}
$user = new WP_User($id);
$user->remove_role('pending_vendor');
$subject = apply_filters('fes_application_declined_message_subj', __('Application Declined', 'edd_fes'), 0);
$message = EDD_FES()->helper->get_option('fes-vendor-app-declined-email', '');
EDD_FES()->emails->send_email($user->user_email, $from_name, $from_email, $subject, $message, "user", $id, array('fes-vendor-app-declined-email-toggle'));
do_action('fes_decline_vendor_admin', $id);
}
if ('suspend_vendor' === $current_action) {
if ($id < 2) {
break;
}
if (user_can($id, 'pending_vendor')) {
break;
}
if (user_can($id, 'suspended_vendor')) {
break;
}
$user = new WP_User($id);
$user->remove_role('frontend_vendor');
$user->add_role('suspended_vendor');
// remove all their posts
$args = array('post_type' => 'download', 'author' => $id, 'posts_per_page' => -1, 'fields' => 'ids', 'post_status' => 'any');
$query = new WP_Query($args);
foreach ($query->posts as $download) {
update_post_meta($download, 'fes_previous_status', get_post_status($download));
// Make sure products are never entirely deleted when suspending a vendor
if (defined('EMPTY_TRASH_DAYS') && !EMPTY_TRASH_DAYS) {
wp_update_post(array('ID' => $download, 'post_status' => 'draft'));
} else {
wp_trash_post($download);
}
}
$subject = apply_filters('fes_vendor_suspended_message_subj', __('Suspended', 'edd_fes'), 0);
$message = EDD_FES()->helper->get_option('fes-vendor-suspended-email', '');
EDD_FES()->emails->send_email($user->user_email, $from_name, $from_email, $subject, $message, 'user', $id, array('fes-vendor-suspended-email-toggle'));
do_action('fes_vendor_suspended_admin', $id);
if (isset($_GET['redirect']) && $_GET['redirect'] == '2') {
wp_redirect(admin_url('admin.php?page=fes-vendors&vendor=' . $id . '&action=edit&approved=2'));
exit;
}
}
if ('unsuspend_vendor' === $current_action) {
if ($id < 2) {
break;
}
if (user_can($id, 'pending_vendor')) {
break;
}
if (user_can($id, 'frontend_vendor')) {
break;
}
$user = new WP_User($id);
$user->add_role('frontend_vendor');
$user->remove_role('suspended_vendor');
// remove all their posts
$args = array('post_type' => 'download', 'author' => $id, 'posts_per_page' => -1, 'fields' => 'ids', 'post_status' => array('pending', 'trash'));
$query = new WP_Query($args);
foreach ($query->posts as $download) {
$status = get_post_meta($download, 'fes_previous_status', true);
if (!$status) {
$status = 'pending';
}
wp_update_post(array('ID' => $download, 'post_status' => $status));
wp_untrash_post_comments($download);
}
$subject = apply_filters('fes_vendor_unsuspended_message_subj', __('Unsuspended', 'edd_fes'), 0);
$message = EDD_FES()->helper->get_option('fes-vendor-unsuspended-email', '');
EDD_FES()->emails->send_email($user->user_email, $from_name, $from_email, $subject, $message, "user", $id, array('fes-vendor-unsuspended-email-toggle'));
do_action('fes_vendor_unsuspended_admin', $id);
if (isset($_GET['redirect']) && $_GET['redirect'] == '2') {
wp_redirect(admin_url('admin.php?page=fes-vendors&vendor=' . $id . '&action=edit&approved=2'));
exit;
}
}
}
}