Is it safe to delete this empty postmeta?
-
The WP Featherlight plugin always adds a field in postmeta (wp_featherlight_disable) and unless we want to disable the Lightbox effect this field is empty. So I ask if it’s safe to use a filter, like the one below, to automatically delete when this field is empty.
add_filter('update_post_metadata', function($check, $object_id, $meta_key, $meta_value, $prev_value) { if(strpos($meta_key, 'wp_featherlight_disable')) { if(empty($meta_value)) { delete_post_meta($object_id, $meta_key, $prev_value); return true; } } return null; }, 10, 5);
Thank you!
- The topic ‘Is it safe to delete this empty postmeta?’ is closed to new replies.