sharing_meta_box_save

The Jetpack by WordPress.com sharing meta box save function.

Description

sharing_meta_box_save( $post_id ); 

Parameters (1)

0. $post_id
The post id.

Usage

  1. if ( !function_exists( 'sharing_meta_box_save' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'jetpack-by-wordpress-com/modules/sharedaddy/sharedaddy.php'; 
  3.  
  4. // The post id. 
  5. $post_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = sharing_meta_box_save($post_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/modules/sharedaddy/sharedaddy.php  
  1. function sharing_meta_box_save( $post_id ) { 
  2. if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) 
  3. return $post_id; 
  4.  
  5. // Record sharing disable 
  6. if ( isset( $_POST['post_type'] ) && ( $post_type_object = get_post_type_object( $_POST['post_type'] ) ) && $post_type_object->public ) { 
  7. if ( current_user_can( 'edit_post', $post_id ) ) { 
  8. if ( isset( $_POST['sharing_status_hidden'] ) ) { 
  9. if ( !isset( $_POST['enable_post_sharing'] ) ) { 
  10. update_post_meta( $post_id, 'sharing_disabled', 1 ); 
  11. } else { 
  12. delete_post_meta( $post_id, 'sharing_disabled' ); 
  13.  
  14. return $post_id;