Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Oct 18, 2016

Conversation

Projects
None yet
2 participants
@PatelUtkarsh
Copy link
Collaborator

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

This comment has been minimized.

Copy link
Collaborator Author

commented Oct 18, 2016

@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;

This comment has been minimized.

Copy link
@westonruter

westonruter Oct 18, 2016

Contributor

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

3 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
coverage/coveralls First build on develop at 94.1%
Details

@westonruter westonruter deleted the bugfix/empty-control-value branch Oct 18, 2016

@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 join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.