/** * Update property with new value. The old value will be deleted. * * @param int $term_id * @param string $slug * @param mixed $value * * @return bool */ function papi_update_term_field($term_id = null, $slug = null, $value = null) { if (!is_numeric($term_id) && is_string($term_id)) { $value = $slug; $slug = $term_id; $term_id = null; } if (!is_string($slug) || empty($slug)) { return false; } if (papi_is_empty($value)) { return papi_delete_term_field($term_id, $slug); } return papi_update_field(papi_get_term_id($term_id), $slug, $value, 'term'); }
/** * Update field with new value. The old value will be deleted. * * @param string $slug * @param mixed $value * * @return bool */ function papi_update_option($slug, $value = null) { return papi_update_field(0, $slug, $value, 'option'); }
/** * Update field with new value. The old value will be deleted. * * @param string $slug * @param mixed $value * * @return bool */ function papi_update_option($slug, $value = null) { return papi_update_field(0, $slug, $value, Papi_Core_Page::TYPE_OPTION); }
/** * Restore to post revision. * * @param int $post_id * @param int $revision_id */ public function restore_post_revision($post_id, $revision_id) { $slugs = papi_get_slugs($revision_id, true); foreach ($slugs as $slug) { $value = papi_get_field($revision_id, $slug); if (papi_is_empty($value)) { papi_delete_field($post_id, $slug); } else { papi_update_field($post_id, $slug, $value); } } }
/** * Update field with new value. The old value will be deleted. * * @param string $slug * @param mixed $value * * @return bool */ function papi_update_option($slug, $value = null) { return papi_update_field(0, $slug, $value, Papi_Option_Page::TYPE); }