From 901e8ed4e664586587dee0ac0690c7b84b98fd3b Mon Sep 17 00:00:00 2001 From: Sathiyamoorthy Venkatesan Date: Thu, 1 Mar 2018 17:38:48 +0530 Subject: [PATCH] Serializes the description field after apply filters --- zoninator.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/zoninator.php b/zoninator.php index 368d705..7fea30a 100644 --- a/zoninator.php +++ b/zoninator.php @@ -916,7 +916,6 @@ function insert_zone( $slug, $name = '', $details = array() ) { $name = ! empty( $name ) ? $name : $slug; $details = wp_parse_args( $details, $this->zone_detail_defaults ); - $details = maybe_serialize( stripslashes_deep( $details ) ); $args = array( 'slug' => $slug, @@ -926,6 +925,9 @@ function insert_zone( $slug, $name = '', $details = array() ) { // Filterize to allow other inputs $args = apply_filters( 'zoninator_insert_zone', $args ); + // Serialize the description. + $args['description'] = maybe_serialize( stripslashes_deep( $args['description'] ) ); + return wp_insert_term( $name, $this->zone_taxonomy, $args ); } @@ -940,9 +942,7 @@ function update_zone( $zone, $data = array() ) { $details = $this->_get_value_or_default( 'details', $data, array() ); // TODO: Back-fill current zone details - //$details = wp_parse_args( $details, $this->zone_detail_defaults ); $details = wp_parse_args( $details, $this->zone_detail_defaults ); - $details = maybe_serialize( stripslashes_deep( $details ) ); $args = array( 'name' => $name, @@ -953,6 +953,9 @@ function update_zone( $zone, $data = array() ) { // Filterize to allow other inputs $args = apply_filters( 'zoninator_update_zone', $args, $zone_id, $zone ); + // Serialize the description. + $args['description'] = maybe_serialize( stripslashes_deep( $args['description'] ) ); + return wp_update_term( $zone_id, $this->zone_taxonomy, $args ); } return new WP_Error( 'invalid-zone', __( 'Sorry, that zone doesn\'t exist.', 'zoninator' ) );