• I was wondering if when a

    wp_delete_post

    function is invoked from code, will WordPress delete automatically related items and will automatically decrease tags counters…

Viewing 2 replies - 1 through 2 (of 2 total)
  • It should.

    Thread Starter Blutarsky

    (@blutarsky)

    Humm…. I have found a code sample like this:

    $custom_field_keys = get_post_custom_keys($postid);
      foreach ( $custom_field_keys as  $key => $value ) {
                $valuet = trim($value);
                if ( '_' != $valuet{0} ){
                     delete_post_meta($postid, $key, '');
                }
      }
      $result = wp_delete_post($postid);

    The code above deletes programmatically custom fields then it deletes the post…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Deleting a post programmatically – relationships?’ is closed to new replies.