WordPress.org

Plugin Directory

Changeset 538823


Ignore:
Timestamp:
05/02/12 08:14:06 (2 years ago)
Author:
tott
Message:
  • Make sure to bypass processing for values that are not available for the custom post type.
  • Allow setting of empty() values
File:
1 edited

Legend:

Unmodified
Added
Removed
  • easy-custom-fields/trunk/easy-custom-fields.php

    r535214 r538823  
    55Plugin URI: http://wordpress.org/extend/plugins/easy-custom-fields/ 
    66Description: A set of extendable classes for easy Custom Field Handling 
    7 Version: 0.4 
     7Version: 0.5 
    88Author: Thorsten Ott 
    99Author URI: http://automattic.com 
     
    429429        public function save_post_cb($post_id, $post) { 
    430430            foreach( (array) $this->_used_fields as $box_id => $field_ids ) { 
     431                // bypass fields which are not used in this group 
     432                if ( !in_array( $_POST['post_type'], $this->_field_data[$box_id]['pages'] ) ) 
     433                    continue; 
     434                     
    431435                if ( ( ! isset($_REQUEST[$this->_plugin_prefix . '_' . $box_id . '_nonce']) ) || ( ! wp_verify_nonce( $_REQUEST[$this->_plugin_prefix . '_' . $box_id . '_nonce'], $this->_plugin_prefix . '_' . $box_id . '_nonce' ) ) ) { 
    432436                    return $post->ID; 
     
    456460                            continue; 
    457461                        } 
    458                         if ( !$value ) { 
    459                             // delete blanks 
    460                             $this->{$field_id}->delete( $post->ID ); 
    461                         } else { 
    462                             $this->{$field_id}->set( $value, $post->ID ); 
    463                         } 
     462                        $this->{$field_id}->set( $value, $post->ID ); 
    464463                    } else { 
    465464                        // delete blanks 
Note: See TracChangeset for help on using the changeset viewer.