Answers for "php wp remove featured image"

CSS
0

hide featured image in wordpress

.entry-thumbnail {
    display: none;    
}
Posted by: Guest on August-01-2020
0

wp delete old featured image programmatically

add_action( 'before_delete_post', 'wps_remove_attachment_with_post', 10 );
function wps_remove_attachment_with_post( $post_id ) {

    /** @var WP_Post[] $images */
    $images = get_attached_media( 'image', $post_id );

    foreach ( $images as $image ) {
        wp_delete_attachment( $image->ID, true );
    }
}
Posted by: Guest on January-14-2021

Browse Popular Code Answers by Language