Smart Custom Fields - Version 1.6.3

Version Description

  • Fixed a bug that metadata that isn't defined by Smart Custom Fields can't get in preview.
Download this release

Release Info

Developer inc2734
Plugin Icon wp plugin Smart Custom Fields
Version 1.6.3
Comparing to
See all releases

Code changes from version 1.6.2 to 1.6.3

classes/models/class.revisions.php CHANGED
@@ -1,10 +1,10 @@
1
  <?php
2
  /**
3
  * Smart_Custom_Fields_Revisions
4
- * Version : 1.1.2
5
  * Author : inc2734
6
  * Created : September 23, 2014
7
- * Modified : March 19, 2015
8
  * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
@@ -84,6 +84,11 @@ class Smart_Custom_Fields_Revisions {
84
  * @return mixed $value
85
  */
86
  public function get_post_metadata( $value, $post_id, $meta_key, $single ) {
 
 
 
 
 
87
  if ( $preview_id = $this->get_preview_id( $post_id ) && $meta_key !== '_thumbnail_id' ) {
88
  if ( $post_id !== $preview_id ) {
89
  $value = get_post_meta( $preview_id, $meta_key, $single );
@@ -101,8 +106,10 @@ class Smart_Custom_Fields_Revisions {
101
  protected function get_preview_id( $post_id ) {
102
  global $post;
103
  $preview_id = 0;
104
- if ( isset( $post->ID ) && intval( $post->ID ) === intval( $post_id ) && is_preview() && $preview = wp_get_post_autosave( $post->ID ) ) {
105
- $preview_id = $preview->ID;
 
 
106
  }
107
  return $preview_id;
108
  }
1
  <?php
2
  /**
3
  * Smart_Custom_Fields_Revisions
4
+ * Version : 1.1.3
5
  * Author : inc2734
6
  * Created : September 23, 2014
7
+ * Modified : November 27, 2015
8
  * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
84
  * @return mixed $value
85
  */
86
  public function get_post_metadata( $value, $post_id, $meta_key, $single ) {
87
+ // $meta_key が SCF で定義されたものでなければスルー
88
+ if ( is_null( SCF::get_field( get_post( $post_id ), $meta_key ) ) ) {
89
+ return $value;
90
+ }
91
+
92
  if ( $preview_id = $this->get_preview_id( $post_id ) && $meta_key !== '_thumbnail_id' ) {
93
  if ( $post_id !== $preview_id ) {
94
  $value = get_post_meta( $preview_id, $meta_key, $single );
106
  protected function get_preview_id( $post_id ) {
107
  global $post;
108
  $preview_id = 0;
109
+ if ( isset( $post->ID ) && intval( $post->ID ) === intval( $post_id ) ) {
110
+ if ( is_preview() && $preview = wp_get_post_autosave( $post->ID ) ) {
111
+ $preview_id = $preview->ID;
112
+ }
113
  }
114
  return $preview_id;
115
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.amazon.co.jp/registry/wishlist/39ANKRNSTNW40
4
  Tags: plugin, custom field, custom, field, meta, meta field, repeat, repeatable
5
  Requires at least: 3.9
6
  Tested up to: 4.4-beta3
7
- Stable tag: 1.6.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -86,6 +86,9 @@ You can send your own language pack to me.
86
 
87
  == Changelog ==
88
 
 
 
 
89
  = 1.6.2 =
90
  * Fixed a bug that sometimes can't get data when there are multiple Smart Custom Fields settings.
91
 
4
  Tags: plugin, custom field, custom, field, meta, meta field, repeat, repeatable
5
  Requires at least: 3.9
6
  Tested up to: 4.4-beta3
7
+ Stable tag: 1.6.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
86
 
87
  == Changelog ==
88
 
89
+ = 1.6.3 =
90
+ * Fixed a bug that metadata that isn't defined by Smart Custom Fields can't get in preview.
91
+
92
  = 1.6.2 =
93
  * Fixed a bug that sometimes can't get data when there are multiple Smart Custom Fields settings.
94
 
smart-custom-fields.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin name: Smart Custom Fields
4
  * Plugin URI: https://github.com/inc2734/smart-custom-fields/
5
  * Description: Smart Custom Fields is a simple plugin that management custom fields.
6
- * Version: 1.6.2
7
  * Author: inc2734
8
  * Author URI: http://2inc.org
9
  * Created: October 9, 2014
3
  * Plugin name: Smart Custom Fields
4
  * Plugin URI: https://github.com/inc2734/smart-custom-fields/
5
  * Description: Smart Custom Fields is a simple plugin that management custom fields.
6
+ * Version: 1.6.3
7
  * Author: inc2734
8
  * Author URI: http://2inc.org
9
  * Created: October 9, 2014