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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions php/class-wp-customize-posts-preview.php
Expand Up @@ -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.

}

if ( $postmeta_setting->single ) {
Expand Down