• Resolved martinlyder

    (@martinlyder)


    Is there anyway i can duplicate a parent post without its children. im using:
    duplicate_post_create_duplicate() function.

Viewing 1 replies (of 1 total)
  • Thread Starter martinlyder

    (@martinlyder)

    Rightnow im using this hack, but a bit of a workaround cloning a lot of data just to delete it again:

      $args = array( 
             'post_parent' => $new_post_id,
             'post_type' => 'templates',
             'post_status' => 'pending'
         );
             
       $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);
                  }
              }
Viewing 1 replies (of 1 total)
  • The topic ‘Dont duplicate children’ is closed to new replies.