• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_delete_term函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: unlinkTranslationFor

 public function unlinkTranslationFor($objectId, $objectKind)
 {
     // Trash the translations' WP_Post first
     global $wpdb;
     $this->logger->logQueryStart();
     $locales = Strata::i18n()->getLocales();
     $app = Strata::app();
     foreach ($locales as $locale) {
         if ($objectKind === "WP_Post" && $locale->isTranslationOfPost($objectId)) {
             $translation = $locale->getTranslatedPost($objectId);
             if (!is_null($translation)) {
                 wp_trash_post($translation->ID);
             }
         } elseif ($objectKind === "Term" && $locale->hasTermTranslation($objectId)) {
             $translation = $locale->getTranslatedTerm($objectId);
             if (!is_null($translation)) {
                 wp_delete_term($translation->term_id);
             }
         }
     }
     // Then delete all the polyglot references
     // to that original post.
     $result = $wpdb->delete($wpdb->prefix . 'polyglot', array("translation_of" => $objectId, "obj_kind" => $objectKind));
     $this->logger->logQueryCompletion($wpdb->last_query);
     return $result;
 }
开发者ID:francoisfaubert,项目名称:strata-polyglot,代码行数:26,代码来源:Query.php


示例2: delete_term_actions

 /**
  * @param int    $tt_id    term taxonomy id of the deleted term
  * @param string $taxonomy taxonomy of the deleted term
  */
 function delete_term_actions($tt_id, $taxonomy)
 {
     $icl_el_type = 'tax_' . $taxonomy;
     if ($this->sitepress->get_setting('sync_delete_tax') && $this->delete_recursion_flag === false) {
         // only for translated
         $lang_details = $this->sitepress->get_element_language_details($tt_id, $icl_el_type);
         if (empty($lang_details->source_language_code)) {
             // get translations
             $trid = $this->sitepress->get_element_trid($tt_id, $icl_el_type);
             $translations = $this->sitepress->get_element_translations($trid, $icl_el_type);
             $this->delete_recursion_flag = true;
             // delete translations
             remove_filter('get_term', array($this->sitepress, 'get_term_adjust_id'), 1);
             foreach ($translations as $translation) {
                 if ((int) $translation->element_id !== (int) $tt_id) {
                     wp_delete_term($translation->term_id, $taxonomy);
                 }
             }
             add_filter('get_term', array($this->sitepress, 'get_term_adjust_id'), 1, 1);
             $this->delete_recursion_flag = false;
         }
     }
     $update_args = array('element_id' => $tt_id, 'element_type' => $icl_el_type, 'context' => 'tax');
     do_action('wpml_translation_update', array_merge($update_args, array('type' => 'before_delete')));
     $this->wpdb->delete($this->wpdb->prefix . 'icl_translations', array('element_type' => $icl_el_type, 'element_id' => $tt_id));
     do_action('wpml_translation_update', array_merge($update_args, array('type' => 'after_delete')));
 }
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:31,代码来源:class-wpml-term-actions.php


示例3: cleanup

 public function cleanup($opt = NULL, $cpt = NULL, $tax = NULL)
 {
     // Perform security checks.
     if (self::authorize() == TRUE) {
         // Remove plugin options from wp_options database table.
         if ($opt) {
             foreach ($opt as $option) {
                 delete_option($option);
             }
         }
         // Remove plugin-specific custom post type entries.
         if ($cpt) {
             $entries = get_posts(array('post_type' => $cpt, 'numberposts' => -1));
             foreach ($entries as $entry) {
                 wp_delete_post($entry->ID, TRUE);
             }
         }
         // Remove plugin-specific custom taxonomy terms.
         if ($tax) {
             global $wp_taxonomies;
             foreach ($tax as $taxonomy) {
                 register_taxonomy($taxonomy['taxonomy'], $taxonomy['object_type']);
                 $terms = get_terms($taxonomy['taxonomy'], array('hide_empty' => 0));
                 foreach ($terms as $term) {
                     wp_delete_term($term->term_id, $taxonomy['taxonomy']);
                 }
                 delete_option($taxonomy['taxonomy'] . '_children');
                 unset($wp_taxonomies[$taxonomy['taxonomy']]);
             }
         }
     }
 }
开发者ID:runinout,项目名称:wppizza,代码行数:32,代码来源:admin.plugin.uninstall.janitor.php


示例4: uninstall

 function uninstall($blog_id = false)
 {
     // delete all taxonomy terms
     register_taxonomy('gn-genre', null);
     $terms = get_terms('gn-genre', array('hide_empty' => false));
     if (is_array($terms)) {
         foreach ($terms as $term) {
             wp_delete_term($term->term_id, 'gn-genre');
         }
     }
     // remove plugin settings
     delete_option('xmlsf_version');
     delete_option('xmlsf_sitemaps');
     delete_option('xmlsf_post_types');
     delete_option('xmlsf_taxonomies');
     delete_option('xmlsf_news_sitemap');
     delete_option('xmlsf_ping');
     delete_option('xmlsf_robots');
     delete_option('xmlsf_urls');
     delete_option('xmlsf_custom_sitemaps');
     delete_option('xmlsf_domains');
     delete_option('xmlsf_news_tags');
     // make rewrite rules update at the appropriate time
     delete_option('rewrite_rules');
     // Kilroy was here
     if ($blog_id) {
         error_log('XML Sitemap Feeds settings cleared from site ' . $blog_id . '.');
     } else {
         error_log('XML Sitemap Feeds settings cleared before uninstall.');
     }
 }
开发者ID:jolay,项目名称:maga2.0,代码行数:31,代码来源:uninstall.php


示例5: deleteData

function deleteData()
{
    global $wpdb;
    delete_option('asgarosforum_options');
    delete_option('asgarosforum_db_version');
    // For site options in multisite
    delete_site_option('asgarosforum_options');
    delete_site_option('asgarosforum_db_version');
    // Delete user meta data
    delete_metadata('user', 0, 'asgarosforum_moderator', '', true);
    delete_metadata('user', 0, 'asgarosforum_banned', '', true);
    delete_metadata('user', 0, 'asgarosforum_subscription_topic', '', true);
    delete_metadata('user', 0, 'asgarosforum_subscription_forum', '', true);
    delete_metadata('user', 0, 'asgarosforum_subscription_global_topics', '', true);
    delete_metadata('user', 0, 'asgarosforum_unread_cleared', '', true);
    delete_metadata('user', 0, 'asgarosforum_unread_exclude', '', true);
    // Delete terms
    $terms = $wpdb->get_col('SELECT t.term_id FROM ' . $wpdb->terms . ' AS t INNER JOIN ' . $wpdb->term_taxonomy . ' AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = "asgarosforum-category";');
    foreach ($terms as $term) {
        wp_delete_term($term, 'asgarosforum-category');
    }
    // Drop custom tables
    $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}forum_forums;");
    $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}forum_threads;");
    $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}forum_posts;");
    // Delete uploaded files
    $upload_dir = wp_upload_dir();
    $upload_path = $upload_dir['basedir'] . '/asgarosforum/';
    recursiveDelete($upload_path);
    // Delete themes
    $theme_path = WP_CONTENT_DIR . '/themes-asgarosforum';
    recursiveDelete($theme_path);
    // Delete data which has been used in old versions of the plugin.
    delete_metadata('user', 0, 'asgarosforum_lastvisit', '', true);
}
开发者ID:Asgaros,项目名称:asgaros-forum,代码行数:35,代码来源:uninstall.php


示例6: test_wp_delete_term_should_invalidate_cache

 /**
  * @ticket 23326
  */
 public function test_wp_delete_term_should_invalidate_cache()
 {
     global $wpdb;
     $this->set_up_three_posts_and_tags();
     // Prime cache
     $terms = get_terms('post_tag');
     $time1 = wp_cache_get('last_changed', 'terms');
     $num_queries = $wpdb->num_queries;
     // Force last_changed to bump.
     wp_delete_term($terms[0]->term_id, 'post_tag');
     $num_queries = $wpdb->num_queries;
     $this->assertNotEquals($time1, $time2 = wp_cache_get('last_changed', 'terms'));
     // last_changed and num_queries should bump after a term is deleted.
     $terms = get_terms('post_tag');
     $this->assertEquals(2, count($terms));
     $this->assertEquals($time2, wp_cache_get('last_changed', 'terms'));
     $this->assertEquals($num_queries + 1, $wpdb->num_queries);
     $num_queries = $wpdb->num_queries;
     // Again. last_changed and num_queries should remain the same.
     $terms = get_terms('post_tag');
     $this->assertEquals(2, count($terms));
     $this->assertEquals($time2, wp_cache_get('last_changed', 'terms'));
     $this->assertEquals($num_queries, $wpdb->num_queries);
     // @todo Repeat with term insert and update.
 }
开发者ID:Benrajalu,项目名称:philRaj,代码行数:28,代码来源:getTerms.php


示例7: uninstall

 /**
  * Uninstall Simmer. Sad face.
  *
  * @since 1.3.0
  */
 public static function uninstall()
 {
     global $wpdb;
     $on_uninstall = get_option('simmer_on_uninstall', 'delete_settings');
     // Check that the user wants everything deleted with the plugin.
     if ('keep_all' == $on_uninstall) {
         return;
     }
     if ('delete_settings' == $on_uninstall || 'delete_all' == $on_uninstall) {
         // Delete options
         $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE 'simmer_%';");
     }
     if ('delete_all' == $on_uninstall) {
         // Delete all recipes.
         $recipe_ids = get_posts(array('post_type' => 'recipe', 'post_status' => 'any', 'numberposts' => -1, 'fields' => 'ids'));
         if ($recipe_ids) {
             foreach ($recipe_ids as $recipe_id) {
                 wp_delete_post($recipe_id, true);
             }
         }
         // Delete all categories.
         $category_ids = get_terms('recipe_category', array('hide_empty' => false, 'fields' => 'ids'));
         if (!is_wp_error($category_ids) && !empty($category_ids)) {
             foreach ($category_ids as $category_id) {
                 wp_delete_term($category_id, 'recipe_category');
             }
         }
         // Remove the custom DB tables.
         $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "simmer_recipe_items");
         $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "simmer_recipe_itemmeta");
     }
 }
开发者ID:bartuspan,项目名称:simmer,代码行数:37,代码来源:class-simmer-installer.php


示例8: test_wp_insert_delete_term

 public function test_wp_insert_delete_term()
 {
     $taxonomy = 'wptests_tax';
     register_taxonomy($taxonomy, 'post');
     // a new unused term
     $term = rand_str();
     $this->assertNull(term_exists($term));
     $initial_count = wp_count_terms($taxonomy);
     $t = wp_insert_term($term, $taxonomy);
     $this->assertInternalType('array', $t);
     $this->assertNotWPError($t);
     $this->assertTrue($t['term_id'] > 0);
     $this->assertTrue($t['term_taxonomy_id'] > 0);
     $this->assertEquals($initial_count + 1, wp_count_terms($taxonomy));
     // make sure the term exists
     $this->assertTrue(term_exists($term) > 0);
     $this->assertTrue(term_exists($t['term_id']) > 0);
     // now delete it
     add_filter('delete_term', array($this, 'deleted_term_cb'), 10, 5);
     $this->assertTrue(wp_delete_term($t['term_id'], $taxonomy));
     remove_filter('delete_term', array($this, 'deleted_term_cb'), 10, 5);
     $this->assertNull(term_exists($term));
     $this->assertNull(term_exists($t['term_id']));
     $this->assertEquals($initial_count, wp_count_terms($taxonomy));
 }
开发者ID:dd32,项目名称:wordpress.develop,代码行数:25,代码来源:wpInsertTerm.php


示例9: spg_clean_data

function spg_clean_data()
{
    $easymedia_values = get_option('easy_media_opt');
    if (is_array($easymedia_values) && array_key_exists($name, $easymedia_values)) {
        $keepornot = $easymedia_values['easymedia_disen_databk'];
    }
    if ($keepornot != '1') {
        //$wpdb->query("DELETE FROM `wp_options` WHERE `option_name` LIKE 'emediagallery_%'");
        delete_option('easy_media_opt');
        // Remove plugin-specific custom post type entries.
        $posts = get_posts(array('numberposts' => -1, 'post_type' => 'easymediagallery', 'post_status' => 'any'));
        foreach ($posts as $post) {
            wp_delete_post($post->ID, true);
        }
        // Remove plugin-specific custom taxonomies and terms.
        $tax = 'emediagallery';
        if (is_taxonomy($tax)) {
            foreach ($tax as $taxonomy) {
                $terms = get_terms($taxonomy, array('get ' => 'all'));
                foreach ($terms as $term) {
                    wp_delete_term($term->term_id, $taxonomy);
                }
                unset($wp_taxonomies[$taxonomy]);
            }
        }
    } else {
    }
}
开发者ID:10Dimensional,项目名称:InspOrg,代码行数:28,代码来源:uninstall.php


示例10: delete

 /**
  * Deletes a record from storage.
  *
  * @param \WordPress\Data\ModelInterface $model
  */
 public function delete(ModelInterface $model)
 {
     if (!$model->term_id || !$model->taxonomy) {
         throw new \RuntimeException("Term must have 'term_id' and 'taxonomy' fields.");
     }
     $result = wp_delete_term($model->term_id, $model->taxonomy);
     return !is_wp_error($result);
 }
开发者ID:wells5609,项目名称:wp-app,代码行数:13,代码来源:Storage.php


示例11: test_delete_term_is_synced

 public function test_delete_term_is_synced()
 {
     wp_delete_term($this->term_object['term_id'], $this->taxonomy);
     $this->client->do_sync();
     $terms = $this->get_terms();
     $server_terms = $this->server_replica_storage->get_terms($this->taxonomy);
     $this->assertEquals($terms, $server_terms);
 }
开发者ID:elliott-stocks,项目名称:jetpack,代码行数:8,代码来源:test_class.jetpack-sync-terms.php


示例12: wpsc_admin_ajax

/**
 * WP eCommerce Admin AJAX functions
 *
 * These are the WPSC Admin AJAX functions
 *
 * @package wp-e-commerce
 * @since 3.7
 *
 * @uses update_option()                              Updates option in the database given key and value
 * @uses wp_delete_term()                             Removes term from the database
 * @uses fetch_rss()                                  DEPRECATED
 * @uses wpsc_member_dedeactivate_subscriptions()     @todo docs
 * @uses wpsc_member_deactivate_subscriptions()       @todo docs
 * @uses wpsc_update_purchase_log_status()            Updates the status of the logs for a purchase
 * @uses transaction_results()                        Main function for creating purchase reports
 * @uses wpsc_find_purchlog_status_name()             Finds name of given status
 */
function wpsc_admin_ajax()
{
    if (!wpsc_is_store_admin()) {
        return;
    }
    global $wpdb;
    if (isset($_POST['action']) && $_POST['action'] == 'product-page-order') {
        $current_order = get_option('wpsc_product_page_order');
        $new_order = $_POST['order'];
        if (isset($new_order["advanced"])) {
            $current_order["advanced"] = array_unique(explode(',', $new_order["advanced"]));
        }
        if (isset($new_order["side"])) {
            $current_order["side"] = array_unique(explode(',', $new_order["side"]));
        }
        update_option('wpsc_product_page_order', $current_order);
        exit(print_r($order, 1));
    }
    if (isset($_POST['save_image_upload_state']) && $_POST['save_image_upload_state'] == 'true' && is_numeric($_POST['image_upload_state'])) {
        $upload_state = (int) (bool) $_POST['image_upload_state'];
        update_option('wpsc_use_flash_uploader', $upload_state);
        exit("done");
    }
    if (isset($_POST['remove_variation_value']) && $_POST['remove_variation_value'] == "true" && is_numeric($_POST['variation_value_id'])) {
        $value_id = absint($_GET['variation_value_id']);
        echo wp_delete_term($value_id, 'wpsc-variation');
        exit;
    }
    if (isset($_REQUEST['log_state']) && $_REQUEST['log_state'] == "true" && is_numeric($_POST['id']) && is_numeric($_POST['value'])) {
        $newvalue = $_POST['value'];
        if ($_REQUEST['suspend'] == 'true') {
            if ($_REQUEST['value'] == 1 && function_exists('wpsc_member_dedeactivate_subscriptions')) {
                wpsc_member_dedeactivate_subscriptions($_POST['id']);
            } elseif (function_exists('wpsc_member_deactivate_subscriptions')) {
                wpsc_member_deactivate_subscriptions($_POST['id']);
            }
            exit;
        } else {
            $log_data = $wpdb->get_row($wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id` = '%d' LIMIT 1", $_POST['id']), ARRAY_A);
            if ($newvalue == 2 && function_exists('wpsc_member_activate_subscriptions')) {
                wpsc_member_activate_subscriptions($_POST['id']);
            }
            wpsc_update_purchase_log_status($_POST['id'], $newvalue);
            if ($newvalue > $log_data['processed'] && $log_data['processed'] < 2) {
                transaction_results($log_data['sessionid'], false);
            }
            $status_name = wpsc_find_purchlog_status_name($purchase['processed']);
            echo "document.getElementById(\"form_group_" . absint($_POST['id']) . "_text\").innerHTML = '" . $status_name . "';\n";
            $year = date("Y");
            $month = date("m");
            $start_timestamp = mktime(0, 0, 0, $month, 1, $year);
            $end_timestamp = mktime(0, 0, 0, $month + 1, 0, $year);
            echo "document.getElementById(\"log_total_month\").innerHTML = '" . addslashes(wpsc_currency_display(admin_display_total_price($start_timestamp, $end_timestamp))) . "';\n";
            echo "document.getElementById(\"log_total_absolute\").innerHTML = '" . addslashes(wpsc_currency_display(admin_display_total_price())) . "';\n";
            exit;
        }
    }
}
开发者ID:VanessaGarcia-Freelance,项目名称:ButtonHut,代码行数:75,代码来源:ajax-and-init.php


示例13: wpTearDownAfterClass

 public static function wpTearDownAfterClass()
 {
     foreach (self::$posts as $post_id) {
         wp_delete_post($post_id, true);
     }
     foreach (self::$cats as $cat) {
         wp_delete_term($cat, 'category');
     }
 }
开发者ID:aaronjorbin,项目名称:WordPress,代码行数:9,代码来源:category.php


示例14: remove

 function remove($group_name) {
     if (!taxonomy_exists($this->taxonomy))
         return FALSE;
     
     if ($term = get_term_by('name', $group_name, $this->taxonomy, OBJECT)) {
         wp_delete_term($term->term_id, $this->taxonomy);
     }
     
 }
开发者ID:RyanFlannagan,项目名称:Wordpress-Meetup-Plugin-,代码行数:9,代码来源:group-taxonomy.php


示例15: es_type_delete

function es_type_delete()
{
    $es_type_id = sanitize_text_field($_POST['es_type_id']);
    global $wpdb;
    wp_delete_term($es_type_id, 'property_type', array());
    $wpdb->delete($wpdb->prefix . 'estatik_manager_types', array('type_id' => $es_type_id));
    echo $es_type_id;
    die;
}
开发者ID:ksan5835,项目名称:rankproperties,代码行数:9,代码来源:es_manager_functions.php


示例16: delete_terms

 /**
  * Deletes all plugin terms.
  *
  * @return void
  */
 private function delete_terms()
 {
     $query = "\nSELECT term_id\nFROM {$this->wpdb->term_taxonomy}\nWHERE taxonomy = %s\nLIMIT 500";
     $query = $this->wpdb->prepare($query, $this->taxonomy);
     while ($term_ids = $this->wpdb->get_col($query)) {
         foreach ($term_ids as $term_id) {
             wp_delete_term($term_id, $this->taxonomy);
         }
     }
 }
开发者ID:tfrommen,项目名称:meta-taxonomy,代码行数:15,代码来源:Uninstaller.php


示例17: geoareas_delete_area

function geoareas_delete_area($taxonomy, $areas)
{
    foreach ($areas as $area) {
        $tid = get_term_by('slug', $area->slug, $taxonomy);
        wp_delete_term($tid, $taxonomy);
        if ($area->children !== NULL) {
            geoareas_delete_area($taxonomy, $area->children);
        }
    }
}
开发者ID:dotancohen,项目名称:geoareas,代码行数:10,代码来源:geoareas.php


示例18: jigoshop_del_coupon

/**
 * Delete coupon type
 *
 * @package		Jigoshop
 * @subpackage 	Jigosgop Coupon Products
 * @since		0.1
 *
**/
function jigoshop_del_coupon()
{
    $product_types = array('coupon');
    foreach ($product_types as $type) {
        $term = get_term_by('slug', sanitize_title($type), 'product_type');
        if ($term) {
            wp_delete_term($term->term_id, 'product_type');
        }
    }
}
开发者ID:not-only-code,项目名称:jigoshop-coupon-products,代码行数:18,代码来源:jigoshop-coupon-products.php


示例19: wp_delete_category

function wp_delete_category($cat_ID) {
	$cat_ID = (int) $cat_ID;
	$default = get_option('default_category');

	// Don't delete the default cat
	if ( $cat_ID == $default )
		return 0;

	return wp_delete_term($cat_ID, 'category', array('default' => $default));
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:10,代码来源:taxonomy.php


示例20: wp_delete_category

function wp_delete_category($cat_ID)
{
    $cat_ID = (int) $cat_ID;
    $default = get_option('default_category');
    // Don't delete the default cat
    if ($cat_ID == $default) {
        return 0;
    }
    return wp_delete_term($cat_ID, 'category', "default={$default}");
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:10,代码来源:taxonomy.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_delete_user函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_delete_post_revision函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap