0

我想在管理员中强制删除父页面删除操作上的所有子页面

你能给人们什么建议?

4

2 回答 2

1

@valir,我刚刚发布了一个名为“完全删除”的插件:http ://wordpress.org/plugins/completely-delete/ 。它专为您想做的事情而设计。一探究竟。

于 2013-12-31T04:41:40.190 回答
0

You can try something like this:

$args = array( 
    'post_parent' => $parentid,
    'post_type' => 'page'
);

$posts = get_posts( $args );

if (is_array($posts) && count($posts) > 0) {

// Delete all the Children of the Parent Page
foreach($posts as $post){

    wp_delete_post($post->ID, true);

}}

// Delete the Parent Page
wp_delete_post($parentid, true);
于 2013-10-29T12:23:11.023 回答