public static function update_orders_value( $post_id, $post ) { if ( is_int( wp_is_post_revision( $post_id ) ) ) return; if ( is_int( wp_is_post_autosave( $post_id ) ) ) return; if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return $post_id; if ( ! current_user_can( 'edit_post', $post_id ) ) return $post_id; if ( $post->post_type != 'product' ) return $post_id; if ( version_compare( WC()->version, '2.2.0', '<' ) ) { $product = get_product( $post ); } else { $product = wc_get_product( $post ); } if ( $product ) { if ( $product->is_on_sale() ) { update_post_meta( $post_id, '_psad_onsale_order', 2 ); } else { update_post_meta( $post_id, '_psad_onsale_order', 1 ); } if ( $product->is_featured() ) { update_post_meta( $post_id, '_psad_featured_order', 2 ); } else { update_post_meta( $post_id, '_psad_featured_order', 1 ); } } }
/** * This function set post in default category. * * @param $post_ID * * @return mixed */ public function save_default_post_categories($post_ID) { if (wp_is_post_autosave($post_ID) || wp_is_post_revision($post_ID)) { return $post_ID; } $categories = wp_get_post_categories($post_ID); if (count($categories) === 1 && $categories[0] === (int) get_option('default_category')) { $cats = (array) $this->get_default_post_category_by_lang(get_post_meta($post_ID, 'translation_lang', true)); wp_set_post_categories($post_ID, $cats); } }
/** * Runs when a post is saved and does an action which the write panel save scripts can hook into. * * @access public * @param int $post_id post identifier * @param object $post post object */ function wc_tab_manager_meta_boxes_save($post_id, $post) { if (empty($post_id) || empty($post) || empty($_POST)) { return; } if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return; } if (is_int(wp_is_post_revision($post))) { return; } if (is_int(wp_is_post_autosave($post))) { return; } if (empty($_POST['woocommerce_meta_nonce']) || !wp_verify_nonce($_POST['woocommerce_meta_nonce'], 'woocommerce_save_data')) { return; } if (!current_user_can('edit_post', $post_id)) { return; } if ('wc_product_tab' != $post->post_type) { return; } do_action('woocommerce_process_wc_product_tab_meta', $post_id, $post); woocommerce_meta_boxes_save_errors(); }
/** * Function responsible for saving the event post. */ function dwci_meta_save_event($post_id) { $is_autosave = wp_is_post_autosave($post_id); $is_revision = wp_is_post_revision($post_id); $is_valid_nonce = isset($_POST['dwci_events_nonce']) && wp_verify_nonce($_POST['dwci_events_nonce'], 'ppl-event-nonce') ? true : false; if ($is_autosave || $is_revision || !$is_valid_nonce) { return; } if (isset($_POST['event_id'])) { update_post_meta($post_id, 'event_id', sanitize_text_field($_POST['event_id'])); } if (!isset($_POST['event_id']) || empty($_POST['event_id'])) { //exit('EVPPTF01032016'); return; //$error = new WP_Error( 'event_id', sprintf( __( 'You have forgotten to specify the %1$s for your function. %2$s Error triggered inside %3$s on line %4$s.', TEXTDOMAIN ), '$args[\'event_id\']', "\n", __FILE__, __LINE__ ) ); } if (isset($_POST['event_date'])) { update_post_meta($post_id, 'event_date', sanitize_text_field($_POST['event_date'])); } if (isset($_POST['event_reg_start'])) { update_post_meta($post_id, 'event_reg_start', sanitize_text_field($_POST['event_reg_start'])); } if (isset($_POST['event_open_seats'])) { update_post_meta($post_id, 'event_open_seats', sanitize_text_field($_POST['event_open_seats'])); } }
/** * Generate a pdf for the post when it is updated. * @param $post_id * @param $post */ public static function save_post($post_id, $post) { if (wp_is_post_autosave($post_id) || wp_is_post_revision($post_id) || !post_type_supports($post->post_type, 'print_pdf') || isset($_REQUEST['bulk_edit'])) { return $post_id; } self::save_pdf($post); }
/** * Check if we're saving, the trigger an action based on the post type. * @param int $post_id * @param object $post */ public function save_meta_boxes($post_id, $post) { // $post_id and $post are required if (empty($post_id) || empty($post) || self::$saved_meta_boxes) { return; } // Don't save meta boxes for revisions or autosaves if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { return; } // Check the nonce if (empty($_POST['restaurantpress_meta_nonce']) || !wp_verify_nonce($_POST['restaurantpress_meta_nonce'], 'restaurantpress_save_data')) { return; } // Check the post being saved == the $post_id to prevent triggering this call for other save_post events if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) { return; } // Check user has permission to edit if (!current_user_can('edit_post', $post_id)) { return; } // We need this save event to run once to avoid potential endless loops. This would have been perfect: self::$saved_meta_boxes = true; // Check the post type if (in_array($post->post_type, array('food_menu', 'food_group'))) { do_action('restaurantpress_process_' . $post->post_type . '_meta', $post_id, $post); } }
public function save_meta_box($post_id) { // Checks save status $is_autosave = wp_is_post_autosave($post_id); $is_revision = wp_is_post_revision($post_id); $is_valid_nonce = isset($_POST['heimdall_meta_box_nonce']) && wp_verify_nonce($_POST['heimdall_meta_box_nonce'], 'heimdall_meta_box') ? 'true' : 'false'; // Exits script depending on save status if ($is_autosave || $is_revision || !$is_valid_nonce) { return $post_id; } // Check the user's permissions. if ('page' == $_POST['post_type']) { if (!current_user_can('edit_page', $post_id)) { return $post_id; } } else { if (!current_user_can('edit_post', $post_id)) { return $post_id; } } // Update the post meta if (isset($_POST['heimdall_secured_page'])) { update_post_meta($post_id, '_heimdall_secured_page', 1); } else { delete_post_meta($post_id, '_heimdall_secured_page'); } if (isset($_POST['heimdall_whitelist']) && is_array($_POST['heimdall_whitelist'])) { update_post_meta($post_id, '_heimdall_whitelist', $_POST['heimdall_whitelist']); } else { delete_post_meta($post_id, '_heimdall_whitelist'); } }
/** * Save meta boxes. * * @param int $post_id * @param object $post */ public function save_meta_boxes($post_id, $post) { // Can't proceed without a post id or post. if (empty($post_id) || empty($post)) { return; } // Don't save meta boxes for revisions or autosaves if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { return; } // Check the post being saved has the same id as the post id. // This will prevent other save post events. if ($this->valid_post_id($post_id)) { return; } // Check if our nonce is vailed. if (!wp_verify_nonce(papi_get_sanitized_post('papi_meta_nonce'), 'papi_save_data')) { return; } // Check for any of the capabilities before we save the code. if (!current_user_can('edit_posts') || !current_user_can('edit_pages')) { return; } $this->save_properties($post_id); }
function save($post_id) { /** * Perform checks */ if (wp_is_post_revision($post_id) || wp_is_post_autosave($post_id)) { return; } if (isset($_REQUEST['doing_wp_cron'])) { return; } if (isset($_REQUEST['post_view'])) { return; } if (!isset($_POST['post_type']) || 'gc' != $_POST['post_type']) { return; } /** * Save data */ $post = get_post($post_id); if (!get_post_meta($post_id, '_gc_id', true) && 'publish' == $post->post_status) { update_post_meta($post_id, '_gc_id', self::get_id($post->post_title)); } }
public function __action_save_post($post_id) { if (wp_is_post_autosave($post_id) || wp_is_post_revision($post_id)) { return $post_id; } $post_type = get_post_type($post_id); foreach ($this->connection_factory->get_connections() as $connection) { $connection_args = $connection->get_args(); if (isset($_POST[$connection->get_name() . '_' . 'to']) && isset($_POST[$connection->get_name() . '_to_nonce']) && wp_verify_nonce($_POST[$connection->get_name() . '_to_nonce'], 'set_' . $connection->get_name() . '_to_' . $post_id)) { if (in_array($post_type, $connection->from())) { $to_ids = empty($_POST[$connection->get_name() . '_to']) ? array() : array_map('intval', explode(',', $_POST[$connection->get_name() . '_to'])); $connection->set_connected_to($post_id, $to_ids); } } if ($connection_args['reciprocal'] && isset($_POST[$connection->get_name() . '_' . 'from']) && isset($_POST[$connection->get_name() . '_from_nonce']) && wp_verify_nonce($_POST[$connection->get_name() . '_from_nonce'], 'set_' . $connection->get_name() . '_from_' . $post_id)) { if (in_array($post_type, $connection->to())) { $from_ids = empty($_POST[$connection->get_name() . '_from']) ? array() : array_map('intval', explode(',', $_POST[$connection->get_name() . '_from'])); $current_from_ids = $connection->get_connected_from_objects($post_id); //remove this post from all the posts this item was removed from foreach (array_diff($current_from_ids, $from_ids) as $from_id_to_remove) { $current_to_ids = $connection->get_connected_to_objects($from_id_to_remove); if (false !== ($offset = array_search($post_id, $current_to_ids))) { array_splice($current_to_ids, $offset, 1); } $connection->set_connected_to($from_id_to_remove, $current_to_ids); } //add this post to all of the currently selected items foreach (array_diff($from_ids, $current_from_ids) as $from_id_to_add) { $connection->set_connected_to($from_id_to_add, array($post_id), true); } } } } }
/** * Determines whether or not post meta can be saved. * * @param int $post_id The id of the post being saved. * @param string $action The feature's action. * @param string $nonce The feature's nonce. * @return boolean Whether the post meta can saved or not. */ public function can_save_post_meta($post_id, $action, $nonce) { $is_autosave = wp_is_post_autosave($post_id); $is_revision = wp_is_post_revision($post_id); $is_valid_nonce = isset($_POST[$nonce]) && wp_verify_nonce($_POST[$nonce], $action); return !($is_autosave || $is_revision) && $is_valid_nonce; }
public function possiblyAddPostThumbnail($postId, $post = false) { if (!$post) { $post = get_post($postId); } if (false === (wp_is_post_autosave($postId) || wp_is_post_revision($postId)) && post_type_supports($post->post_type, 'thumbnail')) { $thumb = get_post_thumbnail_id($postId); if (empty($thumb)) { // get images as attachements $images = get_posts(array('post_type' => 'attachment', 'post_mime_type' => 'image', 'post_parent' => $postId, 'order' => 'ASC', 'orderby' => 'post_date', 'numberposts' => 1)); if (!is_array($images) || count($images) == 0) { // if there are no attachments, search post content preg_match_all('|<img.*?src=[\'"](.*?)[\'"].*?>|i', $post->post_content, $matches); // search for uploaded images in the post if (isset($matches) && isset($matches[1][0]) && strlen(trim($matches[1][0])) > 0) { $image = $matches[1][0]; $this->uploadThumb($post, $image); } } else { $image = array_shift($images); update_post_meta($postId, '_thumbnail_id', $image->ID); return true; } } } }
/** * Save meta data * * @param int $post_id * @param \WP_Post $post */ public function save($post_id, $post) { if (empty($post_id) || empty($post) || empty($_POST)) { return; } if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return; } if (is_int(wp_is_post_revision($post))) { return; } if (is_int(wp_is_post_autosave($post))) { return; } if (empty($_POST['license_wp_nonce']) || !wp_verify_nonce($_POST['license_wp_nonce'], 'save_meta_data')) { return; } if (!current_user_can('edit_post', $post_id)) { return; } if ($post->post_type != 'api_product') { return; } do_action('license_wp_save_api_product', $post_id, $post); }
function site_subheader_metabox_save($post_id) { // Checks save status $is_autosave = wp_is_post_autosave($post_id); $is_revision = wp_is_post_revision($post_id); $is_valid_nonce = isset($_POST['sc_nonce']) && wp_verify_nonce($_POST['sc_nonce'], basename(__FILE__)) ? 'true' : 'false'; // Exits script depending on save status if ($is_autosave || $is_revision || !$is_valid_nonce) { return; } // Checks for input and sanitizes/saves if needed if (isset($_POST['site-subheader-title'])) { update_post_meta($post_id, 'site-subheader-title', sanitize_text_field($_POST['site-subheader-title'])); } if (isset($_POST['site-subheader-text'])) { update_post_meta($post_id, 'site-subheader-text', sanitize_text_field($_POST['site-subheader-text'])); } if (isset($_POST['button-title'])) { update_post_meta($post_id, 'button-title', sanitize_text_field($_POST['button-title'])); } if (isset($_POST['button-url'])) { update_post_meta($post_id, 'button-url', sanitize_text_field($_POST['button-url'])); } if (isset($_POST['button-alt'])) { update_post_meta($post_id, 'button-alt', sanitize_text_field($_POST['button-alt'])); } }
/** * Saves Metabox data to a database. * * @param int $post_id ID of the post we are working with. * @param object $post Post object. * @since 0.1.0 */ public function save_data($post_id, $post) { // Check if nonce is set. if (!isset($_POST['_portfolio_toolkit_nonce'])) { return; } // In case it is, verify it. $nonce = sanitize_key($_POST['_portfolio_toolkit_nonce']); if (!wp_verify_nonce($nonce, plugin_basename(__FILE__))) { return; } // Return if it is a revision or autosave. if (wp_is_post_autosave($post->ID) || wp_is_post_revision($post->ID)) { return; } // Is the user allowed to edit the post or page? if (!current_user_can('edit_post', $post->ID)) { return; } // Loop through meta array, saving or deleting data. foreach ($this->get_fields() as $field) { if (isset($_POST[$field['name']])) { // Sanitize and save data. if ('url' == $field['sntz']) { $value = esc_url_raw(wp_unslash($_POST[$field['name']])); } else { $value = sanitize_text_field(wp_unslash($_POST[$field['name']])); } update_post_meta($post->ID, $field['name'], $value); } else { delete_post_meta($post->ID, $field['name']); } } }
public function user_can_save($post_id) { $is_valid_nonce = isset($_POST['tmj-post-notice-nonce']) && wp_verify_nonce($_POST['tmj-post-notice-nonce'], 'tmj-post-notice-save'); $is_autosave = wp_is_post_autosave($post_id); $is_revision = wp_is_post_revision($post_id); return !($is_autosave || $is_revision) && $is_valid_nonce; }
function woocommerce_meta_boxes_save($post_id, $post) { global $wpdb; if (!$_POST) { return $post_id; } if (is_int(wp_is_post_revision($post_id))) { return; } if (is_int(wp_is_post_autosave($post_id))) { return; } if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return $post_id; } if (!isset($_POST['woocommerce_meta_nonce']) || isset($_POST['woocommerce_meta_nonce']) && !wp_verify_nonce($_POST['woocommerce_meta_nonce'], 'woocommerce_save_data')) { return $post_id; } if (!current_user_can('edit_post', $post_id)) { return $post_id; } if ($post->post_type != 'product' && $post->post_type != 'shop_order' && $post->post_type != 'shop_coupon') { return $post_id; } do_action('woocommerce_process_' . $post->post_type . '_meta', $post_id, $post); }
function royal_user_can_save($post_id, $nonce) { $is_autosave = wp_is_post_autosave($post_id); $is_revision = wp_is_post_revision($post_id); $is_valid_nonce = isset($_POST[$nonce]) && wp_verify_nonce($_POST[$nonce], 'royal_nonce'); // Return true if the user is able to save - otherwise, false. return !($is_autosave || $is_revision) && $is_valid_nonce; }
public static function save_post_meta($post_id, $post) { $data = stripslashes_deep($_POST); if (wp_is_post_autosave($post_id) || wp_is_post_revision($post_id) || !isset($data['wp-convertkit-save-meta-nonce']) || !wp_verify_nonce($data['wp-convertkit-save-meta-nonce'], 'wp-convertkit-save-meta')) { return; } self::_set_meta($post_id, $data['wp-convertkit']); }
public static function save_post($post_id, $post) { if ($parent_id = wp_is_post_revision($post_id) && !wp_is_post_autosave($post_id)) { $meta = piklist('post_custom', $parent_id); foreach ($meta as $key => $value) { add_metadata('post', $post_id, $key, maybe_serialize($value)); } } }
public function _action_admin_save_shortcodes($post_id, $post) { if (wp_is_post_autosave($post_id)) { $original_id = wp_is_post_autosave($post_id); $original_post = get_post($original_id); } else { if (wp_is_post_revision($post_id)) { $original_id = wp_is_post_revision($post_id); $original_post = get_post($original_id); } else { $original_id = $post_id; $original_post = $post; } } if (!$this->is_supported_post($original_id) || !post_type_supports($original_post->post_type, $this->get_parent()->get_supports_feature_name())) { return false; } // todo: field 'content' smth changes ? $post_content = FW_Request::POST('content'); // {"notification":{"1":{"message":"Message!","type":""}},"button":{"1":{},"2":{}},"text_block":{"1":{}}} $input_value = FW_Request::POST($this->meta_key); $tmp_val = json_decode($input_value, true); $new_val = array(); // supported shortcodes $tags = implode('|', array_keys(fw_ext('shortcodes')->get_shortcodes())); $default_values = array(); // only supported tags & integer\alphabetic string id if (preg_match_all('/\\[(' . $tags . ')(?:\\s+[^\\[\\]]*)fw_shortcode_id=[\\"\']([A-Za-z0-9]+)[\\"\'](?:\\s?[^\\[\\]]*)\\]/', $post_content, $output_array)) { foreach ($output_array[0] as $match_key => $match) { $tag = $output_array[1][$match_key]; $id = $output_array[2][$match_key]; if (!isset($tmp_val[$tag]) || !isset($tmp_val[$tag][$id]) || empty($tmp_val[$tag][$id])) { $shortcode = fw_ext('shortcodes')->get_shortcode($tag); if ($shortcode) { $new_val[$tag][$id] = fw_get_options_values_from_input($shortcode->get_options(), array()); } } elseif (isset($tmp_val[$tag][$id]) and false === empty($tmp_val[$tag][$id])) { $new_val[$tag][$id] = $tmp_val[$tag][$id]; } } } // only supported tags match (defaults) if (preg_match_all('/\\[(' . $tags . ')(?:\\s+[^\\[\\]]*).*(?:\\s?[^\\[\\]]*)\\]/', $post_content, $output_array)) { foreach ($output_array[0] as $match_key => $match) { $tag = $output_array[1][$match_key]; $shortcode = fw_ext('shortcodes')->get_shortcode($tag); if (!empty($shortcode) && is_array($shortcode->get_options())) { $default_values[$tag] = fw_get_options_values_from_input($shortcode->get_options(), array()); } } } update_post_meta($post_id, $this->meta_key_defaults, str_replace('\\', '\\\\', json_encode($default_values))); update_post_meta($post_id, $this->meta_key, str_replace('\\', '\\\\', json_encode($new_val))); return true; }
function Grafik_Functions_Metabox_Save($post_id) { $is_autosave = wp_is_post_autosave($post_id); $is_revision = wp_is_post_revision($post_id); $is_verified = wp_verify_nonce($_POST['Grafik_Functions_Metabox_Nonce'], 'Grafik_Functions_Metabox_Nonce'); if ($is_autosave || $is_revision || !$is_verified) { return; } $meta = array('styles' => array('html' => Grafik_WriteEncode($_POST['Grafik_Functions_Metabox_Styles_HTML']), 'behavior-html-global' => (int) $_POST['Grafik_Functions_Metabox_Styles_BehaviorHTML_Global'], 'behavior-html-blog' => (int) $_POST['Grafik_Functions_Metabox_Styles_BehaviorHTML_Blog'], 'behavior-html-posts' => (int) $_POST['Grafik_Functions_Metabox_Styles_BehaviorHTML_Posts'], 'behavior-html-pages' => (int) $_POST['Grafik_Functions_Metabox_Styles_BehaviorHTML_Pages'], 'behavior-html-self' => (int) $_POST['Grafik_Functions_Metabox_Styles_BehaviorHTML_Self']), 'header' => array('tl' => Grafik_WriteEncode($_POST['Grafik_Functions_Metabox_Header_TL']), 'behavior-tl-global' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorTL_Global'], 'behavior-tl-blog' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorTL_Blog'], 'behavior-tl-posts' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorTL_Posts'], 'behavior-tl-pages' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorTL_Pages'], 'behavior-tl-self' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorTL_Self'], 'tr' => Grafik_WriteEncode($_POST['Grafik_Functions_Metabox_Header_TR']), 'behavior-tr-global' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorTR_Global'], 'behavior-tr-blog' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorTR_Blog'], 'behavior-tr-posts' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorTR_Posts'], 'behavior-tr-pages' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorTR_Pages'], 'behavior-tr-self' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorTR_Self'], 'ml' => Grafik_WriteEncode($_POST['Grafik_Functions_Metabox_Header_ML']), 'behavior-ml-global' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorML_Global'], 'behavior-ml-blog' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorML_Blog'], 'behavior-ml-posts' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorML_Posts'], 'behavior-ml-pages' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorML_Pages'], 'behavior-ml-self' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorML_Self'], 'mr' => Grafik_WriteEncode($_POST['Grafik_Functions_Metabox_Header_MR']), 'behavior-mr-global' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorMR_Global'], 'behavior-mr-blog' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorMR_Blog'], 'behavior-mr-posts' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorMR_Posts'], 'behavior-mr-pages' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorMR_Pages'], 'behavior-mr-self' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorMR_Self'], 'bl' => Grafik_WriteEncode($_POST['Grafik_Functions_Metabox_Header_BL']), 'behavior-bl-global' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorBL_Global'], 'behavior-bl-blog' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorBL_Blog'], 'behavior-bl-posts' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorBL_Posts'], 'behavior-bl-pages' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorBL_Pages'], 'behavior-bl-self' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorBL_Self'], 'br' => Grafik_WriteEncode($_POST['Grafik_Functions_Metabox_Header_BR']), 'behavior-br-global' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorBR_Global'], 'behavior-br-blog' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorBR_Blog'], 'behavior-br-posts' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorBR_Posts'], 'behavior-br-pages' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorBR_Pages'], 'behavior-br-self' => (int) $_POST['Grafik_Functions_Metabox_Header_BehaviorBR_Self']), 'content' => array('t' => Grafik_WriteEncode($_POST['Grafik_Functions_Metabox_Content_T']), 'behavior-t-global' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorT_Global'], 'behavior-t-blog' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorT_Blog'], 'behavior-t-posts' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorT_Posts'], 'behavior-t-pages' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorT_Pages'], 'behavior-t-self' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorT_Self'], 'l' => Grafik_WriteEncode($_POST['Grafik_Functions_Metabox_Content_L']), 'behavior-l-global' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorL_Global'], 'behavior-l-blog' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorL_Blog'], 'behavior-l-posts' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorL_Posts'], 'behavior-l-pages' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorL_Pages'], 'behavior-l-self' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorL_Self'], 'c' => Grafik_WriteEncode($_POST['Grafik_Functions_Metabox_Content_C']), 'behavior-c-global' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorC_Global'], 'behavior-c-blog' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorC_Blog'], 'behavior-c-posts' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorC_Posts'], 'behavior-c-pages' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorC_Pages'], 'behavior-c-self' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorC_Self'], 'r' => Grafik_WriteEncode($_POST['Grafik_Functions_Metabox_Content_R']), 'behavior-r-global' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorR_Global'], 'behavior-r-blog' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorR_Blog'], 'behavior-r-posts' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorR_Posts'], 'behavior-r-pages' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorR_Pages'], 'behavior-r-self' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorR_Self'], 'b' => Grafik_WriteEncode($_POST['Grafik_Functions_Metabox_Content_B']), 'behavior-b-global' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorB_Global'], 'behavior-b-blog' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorB_Blog'], 'behavior-b-posts' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorB_Posts'], 'behavior-b-pages' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorB_Pages'], 'behavior-b-self' => (int) $_POST['Grafik_Functions_Metabox_Content_BehaviorB_Self']), 'footer' => array('tl' => Grafik_WriteEncode($_POST['Grafik_Functions_Metabox_Footer_TL']), 'behavior-tl-global' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorTL_Global'], 'behavior-tl-blog' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorTL_Blog'], 'behavior-tl-posts' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorTL_Posts'], 'behavior-tl-pages' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorTL_Pages'], 'behavior-tl-self' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorTL_Self'], 'tr' => Grafik_WriteEncode($_POST['Grafik_Functions_Metabox_Footer_TR']), 'behavior-tr-global' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorTR_Global'], 'behavior-tr-blog' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorTR_Blog'], 'behavior-tr-posts' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorTR_Posts'], 'behavior-tr-pages' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorTR_Pages'], 'behavior-tr-self' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorTR_Self'], 'ml' => Grafik_WriteEncode($_POST['Grafik_Functions_Metabox_Footer_ML']), 'behavior-ml-global' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorML_Global'], 'behavior-ml-blog' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorML_Blog'], 'behavior-ml-posts' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorML_Posts'], 'behavior-ml-pages' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorML_Pages'], 'behavior-ml-self' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorML_Self'], 'mr' => Grafik_WriteEncode($_POST['Grafik_Functions_Metabox_Footer_MR']), 'behavior-mr-global' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorMR_Global'], 'behavior-mr-blog' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorMR_Blog'], 'behavior-mr-posts' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorMR_Posts'], 'behavior-mr-pages' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorMR_Pages'], 'behavior-mr-self' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorMR_Self'], 'bl' => Grafik_WriteEncode($_POST['Grafik_Functions_Metabox_Footer_BL']), 'behavior-bl-global' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorBL_Global'], 'behavior-bl-blog' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorBL_Blog'], 'behavior-bl-posts' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorBL_Posts'], 'behavior-bl-pages' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorBL_Pages'], 'behavior-bl-self' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorBL_Self'], 'br' => Grafik_WriteEncode($_POST['Grafik_Functions_Metabox_Footer_BR']), 'behavior-br-global' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorBR_Global'], 'behavior-br-blog' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorBR_Blog'], 'behavior-br-posts' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorBR_Posts'], 'behavior-br-pages' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorBR_Pages'], 'behavior-br-self' => (int) $_POST['Grafik_Functions_Metabox_Footer_BehaviorBR_Self']), 'scripts' => array('html' => Grafik_WriteEncode($_POST['Grafik_Functions_Metabox_Scripts_HTML']), 'behavior-html-global' => (int) $_POST['Grafik_Functions_Metabox_Scripts_BehaviorHTML_Global'], 'behavior-html-blog' => (int) $_POST['Grafik_Functions_Metabox_Scripts_BehaviorHTML_Blog'], 'behavior-html-posts' => (int) $_POST['Grafik_Functions_Metabox_Scripts_BehaviorHTML_Posts'], 'behavior-html-pages' => (int) $_POST['Grafik_Functions_Metabox_Scripts_BehaviorHTML_Pages'], 'behavior-html-self' => (int) $_POST['Grafik_Functions_Metabox_Scripts_BehaviorHTML_Self'])); update_post_meta($post_id, 'Grafik_Functions', json_encode($meta)); }
/** * * @param type $post_id */ public function save_post($post_id = false) { // Get the post object $post = get_post($post_id); // Bail if post is an autosave, revision, or menu item if (wp_is_post_autosave($post) || wp_is_post_revision($post) || is_nav_menu_item($post)) { return; } // Run autolink callbacks on post content parent::input($post->post_content, $post); }
function theburgh_meta_save($post_id) { $is_autosave = wp_is_post_autosave($post_id); $is_revision = wp_is_post_revision($post_id); $is_valid_nonce = isset($_POST['theburgh_nonce']) && wp_verify_nonce($_POST['theburgh_nonce'], basename(__FILE__)) ? 'true' : 'false'; if ($is_autosave || $is_revision || $is_valid_nonce) { return; } if (isset($_POST['meta-text'])) { update_post_meta($post_id, 'meta-text', sanitize_text_field($_POST['meta-text'])); } }
/** * Save the current meta option on if the Current Post Should have the attendees list hidden * * @param int $post_id */ public function save_attendees_list_option($post_id) { if (!(isset($_POST['tribe-tickets-post-settings']) && wp_verify_nonce($_POST['tribe-tickets-post-settings'], 'tribe-tickets-meta-box'))) { return; } // Bail on autosaves/bulk updates if (wp_is_post_autosave($post_id) || wp_is_post_revision($post_id)) { return; } $is_hidden = (int) (empty($_POST['tribe-tickets-hide-attendees-list']) ? false : (bool) $_POST['tribe-tickets-hide-attendees-list']); update_post_meta($post_id, self::HIDE_META_KEY, $is_hidden); }
function save_wp_image_uploads($post_id) { $is_autosave = wp_is_post_autosave($post_id); $is_revision = wp_is_post_revision($post_id); $is_valid_nonce = isset($_POST['wp_image_uploads']) && wp_verify_nonce($_POST['wp_image_uploads'], basename(__FILE__)); // Exits script depending on save status if ($is_autosave || $is_revision || !$is_valid_nonce) { return; } $data = custom_uploader_exists($_POST); process_custom_upload_data($data, $post_id); update_option('custom_upload_fields', $data); }
/** * Save the link */ function corenominal_metabox_link_save($post_id) { $is_autosave = wp_is_post_autosave($post_id); $is_revision = wp_is_post_revision($post_id); $is_valid_nonce = isset($_POST['metabox_nonce']) && wp_verify_nonce($_POST['metabox_nonce'], basename(__FILE__)) ? 'true' : 'false'; // Exit script depending on save status if ($is_autosave || $is_revision || !$is_valid_nonce) { return; } if (isset($_POST['the_link'])) { update_post_meta($post_id, 'the_link', sanitize_text_field($_POST['the_link'])); } }
/** * Saving meta data from custom fields in post edit page * * @param int $post_id */ public function save_post($post_id) { if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return; } if (wp_is_post_autosave($post_id) || wp_is_post_revision($post_id)) { return; } if (!isset($_POST[SCF_Config::NAME])) { return; } $this->save($_POST, get_post($post_id)); }
function metabox_save($post_id) { $meta_id = $this->meta_id; // Checks save status $is_autosave = wp_is_post_autosave($post_id); $is_revision = wp_is_post_revision($post_id); $is_valid_nonce = isset($_POST[$this->div_id . '_nonce']) && wp_verify_nonce($_POST[$this->div_id . '_nonce'], basename(__FILE__)) ? 'true' : 'false'; // Exits script depending on save status if ($is_autosave || $is_revision || !$is_valid_nonce) { return; } tallybuilder_metabox_form_save($post_id, $meta_id, 'wp_kses'); }
function salva_post($post_id) { $autosave = wp_is_post_autosave($post_id); $revision = wp_is_post_revision($post_id); if ($autosave || $revision) { var_dump($autosave); die; return; } if (isset($_POST['slider_link'])) { update_post_meta($post_id, 'slider_link', sanitize_text_field($_POST['slider_link'])); } }