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


PHP delete_term_meta函数代码示例

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


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

示例1: hocwp_term_delete_meta

function hocwp_term_delete_meta($term_id, $meta_key, $meta_value = '', $delete_all = false)
{
    $version = hocwp_get_wp_version();
    if (version_compare($version, '4.4', '>=')) {
        return delete_term_meta($term_id, $meta_key, $meta_value);
    }
    return delete_metadata('term', $term_id, $meta_value, $meta_value, $delete_all);
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:8,代码来源:term-meta.php

示例2: fsi_term_meta_replace

function fsi_term_meta_replace($term_id, $data)
{
    $meta_keys = array_keys(get_term_meta($term_id));
    foreach ($meta_keys as $meta_key) {
        delete_term_meta($term_id, $meta_key);
    }
    fsi_term_meta_update($term_id, $data);
}
开发者ID:sourcerer-mike,项目名称:wp-fast-simple-import,代码行数:8,代码来源:term-meta.php

示例3: delete_raw_value

 public function delete_raw_value($value = '')
 {
     $action = $this->field->get_definition()->get_is_repetitive() ? 'delete_repetitive' : 'delete';
     do_action("wpcf_termeta_before_{$action}", $this->field);
     $result = delete_term_meta($this->object_id, $this->meta_key, $value);
     do_action("wpcf_termmeta_after_{$action}", $this->field);
     return $result;
 }
开发者ID:axeljohansson1988,项目名称:oddcv,代码行数:8,代码来源:termmeta_field.php

示例4: handle_delete_taxonomy_term

 function handle_delete_taxonomy_term($term, $tt_id)
 {
     require_once "taxonomy-metadata.php";
     $meta_to_remove = get_term_meta($term, '');
     if (is_array($meta_to_remove) && count($meta_to_remove) > 0) {
         foreach ($meta_to_remove as $meta_key => $meta) {
             delete_term_meta($term, $meta_key);
         }
     }
 }
开发者ID:TheMysticalSock,项目名称:westmichigansymphony,代码行数:10,代码来源:class.custom_taxonomy_with_meta.php

示例5: delete_all_fields

 /**
  * Delete all field values!
  *
  * @return bool
  */
 public function delete_all_fields()
 {
     global $wpdb;
     $meta_key = $this->get_meta_key();
     $termmeta_records = $wpdb->get_results($wpdb->prepare("SELECT term_id FROM {$wpdb->termmeta} WHERE meta_key = %s", $meta_key));
     // Delete one by one because we (probably) want all the WP hooks to fire.
     foreach ($termmeta_records as $termmeta) {
         delete_term_meta($termmeta->term_id, $meta_key);
     }
     return true;
 }
开发者ID:lytranuit,项目名称:wordpress,代码行数:16,代码来源:definition_term.php

示例6: tearDown

 public function tearDown()
 {
     if (_fm_phpunit_is_wp_at_least(4.4)) {
         $meta = get_term_meta($this->term_id);
         foreach ($meta as $key => $value) {
             delete_term_meta($this->term_id, $key);
         }
     }
     if (get_current_user_id() != $this->current_user) {
         wp_delete_user(get_current_user_id());
     }
     wp_set_current_user($this->current_user);
 }
开发者ID:enrico-sorcinelli,项目名称:wordpress-fieldmanager,代码行数:13,代码来源:test-fieldmanager-context-term.php

示例7: clean

 /**
  * Delete settings, data and metadata cache.
  * 
  * ## OPTIONS
  * 
  * <what>
  * : The type of data to be removed. Supported: all|settings|postdata|userdata|termdata|cache
  * 
  * [--assume-yes]
  * : Run in non interactive mode.
  * 
  * ## EXAMPLES
  * 
  *     wp amt clean all
  *     wp amt clean settings
  *     wp amt clean postdata
  *     wp amt clean userdata
  *     wp amt clean termdata
  *     wp amt clean cache
  *     wp amt clean cache --assume-yes
  *
  * @synopsis <all|settings|postdata|userdata|termdata|cache> [--assume-yes]
  */
 function clean($args, $assoc_args)
 {
     list($what) = $args;
     if (!in_array($what, array('all', 'settings', 'postdata', 'userdata', 'termdata', 'cache'))) {
         WP_CLI::error('Invalid argument: ' . $what . ' (valid: all|settings|postdata|userdata|termdata|cache)');
     }
     if ($assoc_args['assume-yes']) {
         WP_CLI::line(' ');
         WP_CLI::line('Running in non-interactive mode.');
         WP_CLI::line('Proceeding with ' . $what . ' cleanup...');
     } else {
         // Confirmation
         WP_CLI::line(' ');
         WP_CLI::line('This commands deletes Add-Meta-Tags data from the database.');
         WP_CLI::line('This action is final and cannot be undone.');
         WP_CLI::line(' ');
         echo 'Are you sure you want to do this?  Type \'yes\' to continue: ';
         $handle = fopen('php://stdin', 'r');
         $choice = fgets($handle);
         fclose($handle);
         if (trim($choice) != 'yes') {
             WP_CLI::line('Aborting...');
             exit;
         }
         WP_CLI::line(' ');
         WP_CLI::line('Proceeding with ' . $what . ' cleanup...');
     }
     // Delete AMT settings
     if ($what == 'settings' || $what == 'all') {
         delete_option('add_meta_tags_opts');
         WP_CLI::line('Deleted settings.');
     } elseif ($what == 'postdata' || $what == 'all') {
         $qr_args = array('numberposts' => -1, 'post_type' => 'any', 'post_status' => 'any', 'orderby' => 'id', 'order' => 'ASC', 'suppress_filters' => true);
         $posts_arr = get_posts($qr_args);
         $amt_post_fields = amt_get_post_custom_field_names();
         foreach ($posts_arr as $post) {
             foreach ($amt_post_fields as $amt_post_field) {
                 delete_post_meta($post->ID, $amt_post_field);
             }
         }
         WP_CLI::line('Deleted post custom fields.');
     } elseif ($what == 'userdata' || $what == 'all') {
         $qr_args = array('orderby' => 'login', 'order' => 'ASC', 'fields' => 'all');
         $users_arr = get_users($qr_args);
         $amt_user_fields = amt_get_user_custom_field_names();
         foreach ($users_arr as $user) {
             foreach ($amt_user_fields as $amt_user_field) {
                 delete_user_meta($user->ID, $amt_user_field);
             }
         }
         WP_CLI::line('Deleted user meta fields.');
     } elseif ($what == 'termdata' || $what == 'all') {
         // Get taxonomies
         // Get the custom taxonomy names.
         // Arguments in order to retrieve all public custom taxonomies
         $tax_args = array('public' => true, '_builtin' => true);
         $tax_output = 'names';
         // names or objects
         $tax_operator = 'and';
         // 'and' or 'or'
         $taxonomies = get_taxonomies($tax_args, $tax_output, $tax_operator);
         // Get terms
         $qr_args = array('orderby' => 'id', 'order' => 'ASC', 'fields' => 'all');
         $terms_arr = get_terms($taxonomies, $qr_args);
         // Iterate over our fields and export
         $amt_term_fields = amt_get_term_custom_field_names();
         foreach ($terms_arr as $term) {
             foreach ($amt_term_fields as $amt_term_field) {
                 delete_term_meta($term->term_id, $amt_term_field);
             }
         }
         WP_CLI::line('Deleted term meta fields.');
     } elseif ($what == 'cache' || $what == 'all') {
         // Transients may not be cached in the database, but in a different storage backend.
         // So, here amt_delete_all_transient_metadata_cache() is not used.
         //$result = amt_delete_all_transient_metadata_cache();
         //WP_CLI::line( sprintf('Deleted %d transient metadata cache entries.', $result) );
//.........这里部分代码省略.........
开发者ID:ashenkar,项目名称:sanga,代码行数:101,代码来源:amt-cli.php

示例8: impress_agents_save_term_image

 /**
  * Save the image uploaded
  * @param  string $term_id term slug
  */
 function impress_agents_save_term_image($term_id)
 {
     if (!isset($_POST['impa_term_image_nonce']) || !wp_verify_nonce($_POST['impa_term_image_nonce'], basename(__FILE__))) {
         return;
     }
     $old_image = $this->impress_agents_get_term_image($term_id);
     $new_image = isset($_POST['impa-term-image']) ? $_POST['impa-term-image'] : '';
     if ($old_image && '' === $new_image) {
         delete_term_meta($term_id, 'impa_term_image');
     } else {
         if ($old_image !== $new_image) {
             update_term_meta($term_id, 'impa_term_image', $new_image);
         }
     }
     return $term_id;
 }
开发者ID:agentevolution,项目名称:impress-agents,代码行数:20,代码来源:class-taxonomies.php

示例9: test_deleting_term_meta_should_bust_get_terms_cache

 public function test_deleting_term_meta_should_bust_get_terms_cache()
 {
     $terms = self::factory()->term->create_many(2, array('taxonomy' => 'wptests_tax'));
     add_term_meta($terms[0], 'foo', 'bar');
     add_term_meta($terms[1], 'foo', 'bar');
     // Prime cache.
     $found = get_terms('wptests_tax', array('hide_empty' => false, 'fields' => 'ids', 'meta_query' => array(array('key' => 'foo', 'value' => 'bar'))));
     $this->assertEqualSets(array($terms[0], $terms[1]), $found);
     delete_term_meta($terms[1], 'foo', 'bar');
     $found = get_terms('wptests_tax', array('hide_empty' => false, 'fields' => 'ids', 'meta_query' => array(array('key' => 'foo', 'value' => 'bar'))));
     $this->assertEqualSets(array($terms[0]), $found);
 }
开发者ID:boonebgorges,项目名称:develop.wordpress,代码行数:12,代码来源:meta.php

示例10: delete_woocommerce_term_meta

/**
 * WooCommerce Term Meta API
 *
 * WC tables for storing term meta are @deprecated from WordPress 4.4 since 4.4 has its own table.
 * This function serves as a wrapper, using the new table if present, or falling back to the WC table.
 *
 * @todo These functions should be deprecated with notices in a future WC version, allowing users a chance to upgrade WordPress.
 * @param mixed $term_id
 * @param string $meta_key
 * @param string $meta_value (default: '')
 * @param bool $deprecated (default: false)
 * @return bool
 */
function delete_woocommerce_term_meta($term_id, $meta_key, $meta_value = '', $deprecated = false)
{
    return function_exists('delete_term_meta') ? delete_term_meta($term_id, $meta_key, $meta_value) : delete_metadata('woocommerce_term', $term_id, $meta_key, $meta_value);
}
开发者ID:Korkey128k,项目名称:woocommerce,代码行数:17,代码来源:wc-term-functions.php

示例11: save_category_metaboxes

 /**
  * @param $id
  */
 function save_category_metaboxes($id)
 {
     $awmp_edit = $nonce = null;
     if (isset($_POST['aiosp_edit'])) {
         $awmp_edit = $_POST['aiosp_edit'];
     }
     if (isset($_POST['nonce-aioseop-edit'])) {
         $nonce = $_POST['nonce-aioseop-edit'];
     }
     if (isset($awmp_edit) && !empty($awmp_edit) && wp_verify_nonce($nonce, 'edit-aioseop-nonce')) {
         $optlist = array('keywords', 'description', 'title', 'custom_link', 'sitemap_exclude', 'disable', 'disable_analytics', 'noindex', 'nofollow', 'noodp', 'noydir', 'titleatr', 'menulabel');
         foreach ($optlist as $f) {
             $field = "aiosp_{$f}";
             if (isset($_POST[$field])) {
                 ${$field} = $_POST[$field];
             }
         }
         $optlist = array('keywords', 'description', 'title', 'custom_link', 'noindex', 'nofollow', 'noodp', 'noydir', 'titleatr', 'menulabel');
         if (!!empty($this->options['aiosp_can']) && !empty($this->options['aiosp_customize_canonical_links'])) {
             unset($optlist['custom_link']);
         }
         foreach ($optlist as $f) {
             delete_term_meta($id, "_aioseop_{$f}");
         }
         if ($this->is_admin()) {
             delete_term_meta($id, '_aioseop_sitemap_exclude');
             delete_term_meta($id, '_aioseop_disable');
             delete_term_meta($id, '_aioseop_disable_analytics');
         }
         foreach ($optlist as $f) {
             $var = "aiosp_{$f}";
             $field = "_aioseop_{$f}";
             if (isset(${$var}) && !empty(${$var})) {
                 add_term_meta($id, $field, ${$var});
             }
         }
         if (isset($aiosp_sitemap_exclude) && !empty($aiosp_sitemap_exclude) && $this->is_admin()) {
             add_term_meta($id, '_aioseop_sitemap_exclude', $aiosp_sitemap_exclude);
         }
         if (isset($aiosp_disable) && !empty($aiosp_disable) && $this->is_admin()) {
             add_term_meta($id, '_aioseop_disable', $aiosp_disable);
             if (isset($aiosp_disable_analytics) && !empty($aiosp_disable_analytics)) {
                 add_term_meta($id, '_aioseop_disable_analytics', $aiosp_disable_analytics);
             }
         }
     }
 }
开发者ID:recetasdemama,项目名称:wordpress,代码行数:50,代码来源:aioseop_class.php

示例12: save_term

 /**
  * Display multiple input fields, one per language
  * 
  * @param $term_id the term id
  * @param $tt_id the term taxonomy id
  * @param $taxonomy the term object
  *
  * @since 1.0
  */
 public function save_term($term_id, $tt_id, $taxonomy)
 {
     global $q_config;
     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE || !current_user_can('edit_posts')) {
         // check permission
         return $term_id;
     }
     $term = get_term($term_id, $taxonomy);
     foreach ($q_config['enabled_languages'] as $lang) {
         $meta_name = $this->get_meta_key($lang);
         $meta_value = apply_filters('qts_validate_term_slug', $_POST["qts_{$lang}_slug"], $term, $lang);
         delete_term_meta($term_id, $meta_name);
         update_term_meta($term_id, $meta_name, $meta_value);
     }
 }
开发者ID:Savantos,项目名称:cow-theme,代码行数:24,代码来源:qtranslate-slug.php

示例13: delete_option

/**
*	Main Plugin Uninstall Handler
*	@since 0.1
*	
*	Cleanup Tasks:
*	Delete our 'yikes_simple_taxonomy_ordering_options' stored options
*	Delete all 'tax_position' term meta created by this plugin
*/
// if uninstall not called from WordPress exit
if (!defined('WP_UNINSTALL_PLUGIN')) {
    exit;
}
// Delete the taxonomy ordering options
delete_option('yikes_simple_taxonomy_ordering_options');
// remove ALL 'tax_position' term meta created by this plugin
$registered_taxonomies = get_taxonomies();
// loop over all registered taxonomies
foreach ($registered_taxonomies as $taxonomy) {
    // get terms associated with this taxonomy
    $terms = get_terms($taxonomy, array('hide_empty' => false));
    // if terms are set --
    if ($terms) {
        // loop over site terms
        foreach ($terms as $term) {
            // delete 'tax_position' term meta
            delete_term_meta($term->term_id, 'tax_position');
        }
    }
}
/* End Uninstall.php */
开发者ID:yikesinc,项目名称:yikes-inc-simple-taxonomy-ordering,代码行数:30,代码来源:uninstall.php

示例14: delete_term_meta

             delete_term_meta($term_id, $ashu_feild['id']);
         }
     }
 }
 function save_taxonomy_metadata($term_id)
 {
     foreach ($this->ashu_feild as $ashu_feild) {
         if (isset($ashu_feild['id']) && $ashu_feild['id'] && isset($_POST[$ashu_feild['id']])) {
             if (!current_user_can('manage_categories')) {
                 return;
             }
             $old_data = get_term_meta($term_id, $ashu_feild['id'], true);
             if ($ashu_feild['type'] == 'tinymce') {
                 $data = stripslashes($_POST[$ashu_feild['id']]);
             } elseif ($ashu_feild['type'] == 'checkbox') {
                 $data = $_POST[$ashu_feild['id']];
             } elseif ($ashu_feild['type'] == 'numbers_array' || $ashu_feild['type'] == 'gallery') {
                 $data = explode(',', $_POST[$ashu_feild['id']]);
                 $data = array_filter($data);
             } elseif (in_array($ashu_feild['type'], array('open', 'close', 'title'))) {
                 continue;
             } else {
                 $data = htmlspecialchars($_POST[$ashu_feild['id']], ENT_QUOTES, "UTF-8");
             }
             if ($data == "") {
                 delete_term_meta($term_id, $ashu_feild['id'], $data);
             } else {
                 update_term_meta($term_id, $ashu_feild['id'], $data);
开发者ID:ashuwp,项目名称:Ashuwp_framework,代码行数:28,代码来源:ashuwp_termmeta_feild.php

示例15: action_save_category_form_fields

 function action_save_category_form_fields($term_id)
 {
     $old_usergroups = get_term_meta($term_id, 'usergroups', true);
     $new_usergroups = isset($_POST['category_usergroups']) ? $_POST['category_usergroups'] : '';
     if ($new_usergroups === '') {
         delete_term_meta($term_id, 'usergroups');
     } else {
         update_term_meta($term_id, 'usergroups', $new_usergroups);
     }
 }
开发者ID:Asgaros,项目名称:asgaros-forum-user-groups,代码行数:10,代码来源:asgaros-forum-user-groups.php


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