当前位置: 首页>>代码示例>>PHP>>正文


PHP update_metadata函数代码示例

本文整理汇总了PHP中update_metadata函数的典型用法代码示例。如果您正苦于以下问题:PHP update_metadata函数的具体用法?PHP update_metadata怎么用?PHP update_metadata使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了update_metadata函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update_meta

 /**
  * Update term meta field based on term ID.
  *
  */
 public static function update_meta($term_id, $meta_key, $meta_value, $prev_value = '')
 {
     if (current_theme_supports('extended-taxonomies')) {
         return update_post_meta(self::get_post_for_extended_term($term_id)->ID, $meta_key, $meta_value, $prev_value);
     }
     return update_metadata('taxonomy', $term_id, $meta_key, $meta_value, $prev_value);
 }
开发者ID:ksan5835,项目名称:rankproperties,代码行数:11,代码来源:class-term.php

示例2: restore_revision

 public static function restore_revision($post_id, $revision_id)
 {
     $meta = piklist('post_custom', $revision->ID);
     foreach ($meta as $key => $value) {
         update_metadata('post', $post_id, $key, $value);
     }
 }
开发者ID:Themes-Protoarte,项目名称:piklist,代码行数:7,代码来源:class-piklist-revision.php

示例3: test_slashed_key_for_existing_metadata

 /**
  * @ticket 35795
  */
 public function test_slashed_key_for_existing_metadata()
 {
     global $wpdb;
     add_metadata('post', 123, wp_slash('foo\\foo'), 'bar');
     update_metadata('post', 123, wp_slash('foo\\foo'), 'baz');
     $found = get_metadata('post', 123, 'foo\\foo', true);
     $this->assertSame('baz', $found);
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:11,代码来源:updateMetadata.php

示例4: persist

 /**
  * @param WP_Post $post
  * @param WP_Post $revision
  */
 public function persist(WP_Post $post, WP_Post $revision)
 {
     $value = $_REQUEST[$this->getKey()];
     $format = 'Y-m-d H:i:s';
     if (isset($this->options['config']['timepicker']) && $this->options['config']['timepicker'] == false) {
         $format = 'Y-m-d';
     }
     update_metadata('post', $revision->ID, $this->getKey(), date_i18n($format, strtotime($value)));
 }
开发者ID:tmf,项目名称:wp-metabox-helper,代码行数:13,代码来源:class-datetime-item.php

示例5: save_item_category

function save_item_category($term_id, $tt_id)
{
    if (!$term_id) {
        return;
    }
    if (isset($_POST['ait_item_category_thumbnail'])) {
        update_metadata(str_replace("-", "_", $_POST['taxonomy']), $term_id, 'ait_item_category_thumbnail', $_POST['ait_item_category_thumbnail']);
    }
}
开发者ID:simeont9,项目名称:stoneopen,代码行数:9,代码来源:item.php

示例6: update_field

 /**
  * Update the value of the specified metadata field of the object wrapped by this container. 
  *
  * @access protected
  *
  * @param string $field Meta name.
  * @param string $new_value New meta value. 
  * @param string $old_value old meta value.     
  * @return bool|WP_Error True on success, an error object if something went wrong.
  */
 function update_field($field, $new_value, $old_value = '')
 {
     $rez = update_metadata($this->meta_type, $this->container_id, $field, $new_value, $old_value);
     if ($rez) {
         return true;
     } else {
         return new WP_Error('metadata_update_failed', sprintf(__("Failed to update the meta field '%s' on %s [%d]", 'broken-link-checker'), $field, $this->meta_type, $this->container_id));
     }
 }
开发者ID:Weissenberger13,项目名称:web.portugalrentalcottages,代码行数:19,代码来源:custom_field.php

示例7: update

 /**
  * Update a meta field.
  *
  * @alias set
  * @synopsis <id> <key> <value>
  */
 public function update($args, $assoc_args)
 {
     list($object_id, $meta_key, $meta_value) = $args;
     $success = update_metadata($this->meta_type, $object_id, $meta_key, $meta_value);
     if ($success) {
         WP_CLI::success("Updated custom field.");
     } else {
         WP_CLI::error("Failed to update custom field.");
     }
 }
开发者ID:netcon-source,项目名称:wp-cli,代码行数:16,代码来源:class-wp-cli-command-with-meta.php

示例8: saveThumbnail

 public function saveThumbnail($termId, $ttId, $taxonomy)
 {
     if ($taxonomy != Types::PRODUCT_CATEGORY) {
         return;
     }
     $thumbnail = isset($_POST[Types::PRODUCT_CATEGORY . '_thumbnail_id']) ? $_POST[Types::PRODUCT_CATEGORY . '_thumbnail_id'] : false;
     if (!is_numeric($thumbnail)) {
         return;
     }
     update_metadata(Core::TERMS, $termId, 'thumbnail_id', (int) $thumbnail);
 }
开发者ID:jigoshop,项目名称:Jigoshop2,代码行数:11,代码来源:ProductCategories.php

示例9: update_data

 public function update_data($new_value, $single = true)
 {
     extract($this->data_args(array('new_value' => $new_value, 'single' => $single)));
     if ('options-page' === $type) {
         return rrze_Meta_Box::update_option($id, $field_id, $new_value, $single);
     }
     if (!$single) {
         return add_metadata($type, $id, $field_id, $new_value, false);
     }
     return update_metadata($type, $id, $field_id, $new_value);
 }
开发者ID:RRZE-Webteam,项目名称:fau-studienangebot,代码行数:11,代码来源:rrze_meta_box_field.php

示例10: easy_ads_update_section_meta

function easy_ads_update_section_meta($post_id, $field_name, $value = '')
{
    if (empty($value) or !$value) {
        $doo = delete_metadata('easy_ads_taxnomy_sections_', $post_id, $field_name, $value);
    } elseif (!get_metadata('easy_ads_taxnomy_sections_', $post_id, $field_name)) {
        $doo = add_metadata('easy_ads_taxnomy_sections_', $post_id, $field_name, $value);
    } else {
        $doo = update_metadata('easy_ads_taxnomy_sections_', $post_id, $field_name, $value);
    }
    return $doo;
}
开发者ID:shokry055,项目名称:easy-ads-manager,代码行数:11,代码来源:easy-ads-functions.php

示例11: save

 /**
  * Save matadata object
  *
  * @return int the metadata object id
  */
 function save()
 {
     if ($this->id > 0) {
         return update_metadata($this->id, $this->name, $this->value, $this->value_type, $this->owner_guid, $this->access_id);
     } else {
         $this->id = create_metadata($this->entity_guid, $this->name, $this->value, $this->value_type, $this->owner_guid, $this->access_id);
         if (!$this->id) {
             throw new IOException(elgg_echo('IOException:UnableToSaveNew', array(get_class())));
         }
         return $this->id;
     }
 }
开发者ID:redvabel,项目名称:Vabelgg,代码行数:17,代码来源:ElggMetadata.php

示例12: update

 /**
  * Update meta field for a user
  *
  * @param array $args
  * @param array $assoc_args
  **/
 public function update($args, $assoc_args)
 {
     $object_id = WP_CLI::get_numeric_arg($args, 0, "{$this->meta_type} ID");
     $meta_key = self::get_arg_or_error($args, 1, "meta_key");
     $meta_value = self::get_arg_or_error($args, 2, "meta_value");
     $success = update_metadata($this->meta_type, $object_id, $meta_key, $meta_value);
     if ($success) {
         WP_CLI::success("Updated custom field.");
     } else {
         WP_CLI::error("Failed to update custom field.");
     }
 }
开发者ID:roelven,项目名称:wp-cli,代码行数:18,代码来源:class-wp-cli-command-with-meta.php

示例13: save

 /**
  * Save metadata object
  *
  * @return int|bool the metadata object id or true if updated
  *
  * @throws IOException
  */
 public function save()
 {
     if ($this->id > 0) {
         return update_metadata($this->id, $this->name, $this->value, $this->value_type, $this->owner_guid, $this->access_id);
     } else {
         $this->id = create_metadata($this->entity_guid, $this->name, $this->value, $this->value_type, $this->owner_guid, $this->access_id);
         if (!$this->id) {
             throw new \IOException("Unable to save new " . get_class());
         }
         return $this->id;
     }
 }
开发者ID:ibou77,项目名称:elgg,代码行数:19,代码来源:ElggMetadata.php

示例14: do_save

 public function do_save($return_val, $params, $metas, $module)
 {
     $status = false;
     if (!isset($params['meta_value'])) {
         return false;
     }
     if (empty($params['meta_key'])) {
         return false;
     }
     if (!is_null($params['meta_value'])) {
         $status = update_metadata($this->object_name, $this->object_id, $params['meta_key'], $params['meta_value']);
     }
     return $status;
 }
开发者ID:juanfra,项目名称:fakerpress,代码行数:14,代码来源:meta.php

示例15: unsubscribe

 public function unsubscribe($user_id)
 {
     $subscriber_ids = $this->subscriber_ids();
     if (in_array($user_id, $subscriber_ids)) {
         $subscriber_ids = array_diff($subscriber_ids, array($user_id));
         update_metadata($this->meta_type, $this->id, self::SUBSCRIBED_META_KEY, $subscriber_ids);
         /**
          * A post subscription has been removed.
          *
          * @param int $subscriber_id
          * @param Prompt_Interface_Subscribable $object The thing subscribed to.
          */
         do_action('prompt/unsubscribed', $user_id, $this, $this->meta_type);
     }
     return $this;
 }
开发者ID:postmatic,项目名称:beta-dist,代码行数:16,代码来源:meta-subscribable-object.php


注:本文中的update_metadata函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。