Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function sd_before_delete_post( $post_id ) {
- // check if profile
- if ( in_array( get_post_type( $post_id ), [ PostTypes::PROFILE, PostTypes::COMPANY ] ) ) {
- $media = get_children( array(
- 'post_parent' => $post_id,
- 'post_type' => 'any',
- 'numberposts' => -1,
- 'post_status' => 'any',
- ) );
- if ( ! empty( $media ) ) {
- foreach ( $media as $file ) {
- wp_delete_attachment( $file->ID, true );
- }
- }
- do_action( 'delete_sd8_transients', PostTypes::PROFILE );
- do_action( 'delete_sd8_transients', PostTypes::COMPANY );
- }
- // @TODO: delete_row from sd8_icl_translations where element_id == $post_id
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement