Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions zoninator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 );
}

Expand All @@ -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,
Expand All @@ -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' ) );
Expand Down