Created
February 8, 2019 13:41
-
-
Save ozlemcimen/c125b2c07e3960b7ab1841e19b75c9b1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function wolinka_auto_delete_of_post_thumbnail($post_id) { | |
| if(has_post_thumbnail( $post_id )){ | |
| $attachment_id = get_post_thumbnail_id( $post_id ); | |
| wp_delete_attachment($attachment_id, true); | |
| } | |
| } | |
| add_action( 'before_delete_post', 'wolinka_auto_delete_of_post_thumbnail', 10 ); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment