Browse code

post_metaのキーの取得処理修正

nita authored on 2015/10/17 19:23:26
Showing 2 changed files
... ...
@@ -184,9 +184,8 @@ class Class_Rucy_Editer {
184 184
                 $_POST[$post_meta_keys->accept]  = "0";
185 185
         }
186 186
         // save post meta 
187
-        $meta_keys = array( 'accept', 'content', 'date', 'feature_img', 'accept_feature_img', 'accept_update' );
188
-        foreach ( $meta_keys as $mk ) {
189
-            $component->save_rc_post_meta_base( $post_id, $post_meta_keys->$mk, $_POST );
187
+        foreach ( $post_meta_keys as $key => $value ) {
188
+            $component->save_rc_post_meta_base( $post_id, $value, $_POST );
190 189
         }
191 190
         // regist reserve update content
192 191
         if ( $_POST[$post_meta_keys->accept] == "1" ) {
... ...
@@ -75,7 +75,7 @@ class Rucy_Class {
75 75
         global $hook_suffix;
76 76
         if ( in_array( $hook_suffix, array( 'post.php', 'post-new.php' ) ) ) {
77 77
             wp_register_style('rucy.css', RC_PLUGIN_URL . 'css/rucy.css',array(),'0.1.0');
78
-            wp_register_script('rucy.js', RC_PLUGIN_URL . 'js/rucy.js', array('jquery'), '0.1.0');
78
+            wp_register_script('rucy.js', RC_PLUGIN_URL . 'js/rucy.js', array('jquery'), '0.1.1');
79 79
             wp_enqueue_style('rucy.css');
80 80
             wp_enqueue_script('rucy.js');
81 81
         }
... ...
@@ -115,10 +115,11 @@ class Rucy_Class {
115 115
         wp_clear_scheduled_hook( RC_CRON_HOOK );
116 116
         delete_option( RC_SETTING_OPTION_KEY );
117 117
         $all_posts = get_posts( 'numberposts=-1&post_status=' );
118
-        $meta_keys = array( 'accept', 'content', 'date', 'feature_img', 'accept_feature_img', 'accept_update' );
118
+        $component = new Class_Rucy_Component();
119
+        $post_meta_keys = $component->get_post_meta_keys();
119 120
         foreach ( $all_posts as $post_info ) {
120
-            foreach ( $meta_keys as $key ) {
121
-                delete_post_meta( $post_info->ID, $key );
121
+            foreach ( $post_meta_keys as $key => $value ) {
122
+                delete_post_meta( $post_info->ID, $value );
122 123
             }
123 124
         }
124 125
     }