title: Wordpress: custom post type delete post permanently
body: <p>So I want my posts in my custom post type deleted permanently instead of moving to trash first.
  so I found this code online that is supposed to do the trick. 
  But I'm not able to get it to work somehow.</p>
  
  <p>The code that I have is as follows.</p>
  
  <pre><code>function directory_skip_trash($post_id) {
      if (get_post_type($post_id) == 'directory') {
          // Force delete
          wp_delete_post( $post_id, true );
      }
  }
  add_action('wp_trash_post', 'directory_skip_trash');
  </code></pre>
  
  <hr>
  
  <p>The rest of the code of my custom post type itself u can find in <a href="https://stackoverflow.com/questions/60432200/wordpress-how-to-make-unique-field-with-acf-and-custom-post-type">this post</a> that I've made earlier.</p>
  
  <p>I'm probably missing out on something pretty simple.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>so now it got it to kinda work.
  It does actually delete the post but I get this error.
  <a href="https://i.stack.imgur.com/pfwsm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pfwsm.png" alt="enter image description here"></a>
  after the error, if I return to the post page the post is gone and not in the trash
  anyone that might have a solution for it to just remove and not give this message?</p>