Skip to content

Commit

Permalink
Adding the new $update available for save_post in WP 3.6 just committ…
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0ttkclark committed Jul 28, 2013
1 parent c7e4b66 commit b55c8b3
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions classes/PodsMeta.php
Expand Up @@ -120,7 +120,7 @@ public function core () {

add_action( 'add_meta_boxes', array( $this, 'meta_post_add' ) );
add_action( 'transition_post_status', array( $this, 'save_post_detect_new' ), 10, 3 );
add_action( 'save_post', array( $this, 'save_post' ), 10, 2 );
add_action( 'save_post', array( $this, 'save_post' ), 10, 3 );

if ( apply_filters( 'pods_meta_handler', true, 'post' ) ) {
// Handle *_post_meta
Expand Down Expand Up @@ -539,8 +539,8 @@ public function group_add ( $pod, $label, $fields, $context = 'normal', $priorit
if ( !has_action( 'add_meta_boxes', array( $this, 'meta_post_add' ) ) )
add_action( 'add_meta_boxes', array( $this, 'meta_post_add' ) );

/*if ( !has_action( 'save_post', array( $this, 'save_post' ), 10, 2 ) )
add_action( 'save_post', array( $this, 'save_post' ), 10, 2 );*/
/*if ( !has_action( 'save_post', array( $this, 'save_post' ), 10, 3 ) )
add_action( 'save_post', array( $this, 'save_post' ), 10, 3 );*/
}
elseif ( 'taxonomy' == $pod[ 'type' ] ) {
if ( !has_action( $pod[ 'object' ] . '_edit_form_fields', array( $this, 'meta_taxonomy' ), 10, 2 ) ) {
Expand Down Expand Up @@ -835,13 +835,16 @@ public function save_post_detect_new ( $new_status, $old_status, $post ) {
/**
* @param $post_id
* @param $post
* @param $update
*
* @return mixed
*/
public function save_post ( $post_id, $post ) {
public function save_post ( $post_id, $post, $update = null ) {
$is_new_item = false;

if ( 'new' == self::$old_post_status )
if ( is_bool( $update ) )
$is_new_item = $update;
elseif ( 'new' == self::$old_post_status )
$is_new_item = true;

// Reset to avoid manual new post issues
Expand Down

0 comments on commit b55c8b3

Please sign in to comment.