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

Fix handling of postmeta preview filter when no modifications are in customized state #309

Merged
merged 1 commit into from
Oct 18, 2016

Conversation

PatelUtkarsh
Copy link
Member

@PatelUtkarsh PatelUtkarsh commented Oct 18, 2016

Return null if can not preview customize postmeta setting

Issue discussion 0df94bb#commitcomment-19463405

@PatelUtkarsh PatelUtkarsh changed the title Return null if can not preview customize postmeta value Return null if can not preview customize postmeta setting Oct 18, 2016
@PatelUtkarsh
Copy link
Member Author

@westonruter not sure if this is a correct solution so feel free to amend or close this PR.

@@ -1139,6 +1139,8 @@ public function filter_get_post_meta_to_preview( $value, $object_id, $meta_key,
);
if ( $can_preview ) {
$value = $postmeta_setting->post_value();
} else {
return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes sense, because the filter is originally invoked with null:

$check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single );

Also, the null !== $value check is done above to “Abort if another filter has already short-circuited.” So we know at this point that $value is null, so this could either return null like you're doing here or return $value.

@westonruter westonruter added this to the 0.8.3 milestone Oct 18, 2016
@westonruter westonruter merged commit eeb6edc into develop Oct 18, 2016
@westonruter westonruter deleted the bugfix/empty-control-value branch October 18, 2016 16:16
@westonruter westonruter changed the title Return null if can not preview customize postmeta setting Fix handling of postmeta preview filter when no modifications are in customized state Nov 24, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants