Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Commit

Permalink
Issue #17 : Remove need for object brace notation.
Browse files Browse the repository at this point in the history
At Weston's suggestion, pass second argument to json_decode.
This will then return an array, instead of an object.
So access the array value with $data[ $setting_id ].
Instead of previous object access with $data->{ $setting_id }.
  • Loading branch information
Ryan Kienstra committed Sep 3, 2016
1 parent 35d5bca commit 92f14c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions php/class-post-type.php
Expand Up @@ -719,9 +719,9 @@ public function filter_out_settings_if_removed_in_metabox( $content ) {
}

$setting_ids_to_unset = $_REQUEST[ $key_for_settings ];
$data = json_decode( $post->post_content );
$data = json_decode( $post->post_content, true );
foreach ( $setting_ids_to_unset as $setting_id ) {
unset( $data->{ $setting_id } );
unset( $data[ $setting_id ] );
}
$content = Customize_Snapshot_Manager::encode_json( $data );

Expand Down

0 comments on commit 92f14c0

Please sign in to comment.