我想在管理员中强制删除父页面删除操作上的所有子页面
你能给人们什么建议?
@valir,我刚刚发布了一个名为“完全删除”的插件:http ://wordpress.org/plugins/completely-delete/ 。它专为您想做的事情而设计。一探究竟。
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);