getBy( 'post_id', $post_id )->isEmpty(); if ( $is_post ) { $post->delete(); } else { $image = new PMXI_Image_Record(); $image->getBy( 'attachment_id', $post_id )->isEmpty() or $image->delete(); } } }