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


PHP wpcf_is_reserved_name函数代码示例

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


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

示例1: wpcf_admin_custom_taxonomies_form_submit

/**
 * Submit function
 */
function wpcf_admin_custom_taxonomies_form_submit($form)
{
    if (!isset($_POST['ct'])) {
        return false;
    }
    $data = $_POST['ct'];
    $update = false;
    // Sanitize data
    if (isset($data['wpcf-tax'])) {
        $update = true;
        $data['wpcf-tax'] = sanitize_title($data['wpcf-tax']);
    }
    if (isset($data['slug'])) {
        $data['slug'] = sanitize_title($data['slug']);
    }
    if (isset($data['rewrite']['slug'])) {
        $data['rewrite']['slug'] = remove_accents($data['rewrite']['slug']);
        $data['rewrite']['slug'] = strtolower($data['rewrite']['slug']);
        $data['rewrite']['slug'] = trim($data['rewrite']['slug']);
    }
    // Set tax name
    $tax = '';
    if (!empty($data['slug'])) {
        $tax = $data['slug'];
    } else {
        if (!empty($data['wpcf-tax'])) {
            $tax = $data['wpcf-tax'];
        } else {
            if (!empty($data['labels']['singular_name'])) {
                $tax = sanitize_title($data['labels']['singular_name']);
            }
        }
    }
    if (empty($tax)) {
        wpcf_admin_message(__('Please set taxonomy name', 'wpcf'), 'error');
        return false;
    }
    if (empty($data['labels']['singular_name'])) {
        $data['labels']['singular_name'] = $tax;
    }
    $data['slug'] = $tax;
    $custom_taxonomies = get_option('wpcf-custom-taxonomies', array());
    // Check reserved name
    if (wpcf_is_reserved_name($tax)) {
        wpcf_admin_message(sprintf(__('The name %s is reserved in WordPress and cannot be used in custom taxonomies. Please use a different name.', 'wpcf'), $tax), 'error');
        return false;
    }
    // Check if exists
    if ($update && !array_key_exists($data['wpcf-tax'], $custom_taxonomies)) {
        wpcf_admin_message(__("Custom taxonomy do not exist", 'wpcf'), 'error');
        return false;
    }
    // Check overwriting
    if (!$update && array_key_exists($tax, $custom_taxonomies)) {
        wpcf_admin_message(__('Custom taxonomy already exists', 'wpcf'), 'error');
        return false;
    }
    // Check if our tax overwrites some tax outside
    $tax_exists = get_taxonomy($tax);
    if (!$update && !empty($tax_exists)) {
        wpcf_admin_message(__('Taxonomy already exists', 'wpcf'), 'error');
        return false;
    }
    // Check if renaming
    if ($update && $data['wpcf-tax'] != $tax) {
        global $wpdb;
        $wpdb->update($wpdb->term_taxonomy, array('taxonomy' => $tax), array('taxonomy' => $data['wpcf-tax']), array('%s'), array('%s'));
        // Delete old type
        unset($custom_taxonomies[$data['wpcf-tax']]);
    }
    // Check if active
    if (isset($custom_taxonomies[$tax]['disabled'])) {
        $data['disabled'] = $custom_taxonomies[$tax]['disabled'];
    }
    // Sync with post types
    if (!empty($data['supports'])) {
        $post_types = get_option('wpcf-custom-types', array());
        foreach ($post_types as $id => $type) {
            if (array_key_exists($id, $data['supports'])) {
                $post_types[$id]['taxonomies'][$data['slug']] = 1;
            } else {
                unset($post_types[$id]['taxonomies'][$data['slug']]);
            }
        }
        update_option('wpcf-custom-types', $post_types);
    }
    $custom_taxonomies[$tax] = $data;
    update_option('wpcf-custom-taxonomies', $custom_taxonomies);
    // WPML register strings
    wpcf_custom_taxonimies_register_translation($tax, $data);
    wpcf_admin_message_store(__('Custom taxonomy saved', 'wpcf'));
    // Flush rewrite rules
    flush_rewrite_rules();
    // Redirect
    wp_redirect(admin_url('admin.php?page=wpcf-edit-tax&wpcf-tax=' . $tax . '&wpcf-rewrite=1'));
    die;
}
开发者ID:dewavi,项目名称:occupysandy.net,代码行数:100,代码来源:custom-taxonomies-form.php

示例2: ajax_wpcf_is_reserved_name

function ajax_wpcf_is_reserved_name()
{
    // slug
    $name = isset($_POST['slug']) ? $_POST['slug'] : '';
    // context
    $context = isset($_POST['context']) ? $_POST['context'] : false;
    // check also page slugs
    $check_pages = isset($_POST['check_pages']) && $_POST['check_pages'] == false ? false : true;
    // slug pre save
    if (isset($_POST['slugPreSave']) && $_POST['slugPreSave'] !== 0) {
        // for taxonomy
        if ($context == 'taxonomy') {
            $_POST['ct']['wpcf-tax'] = $_POST['slugPreSave'];
        }
        // for post_type
        if ($context == 'post_type') {
            $_POST['ct']['wpcf-post-type'] = $_POST['slugPreSave'];
        }
    }
    if ($context == 'post_type' || $context == 'taxonomy') {
        $used_reserved = wpcf_is_reserved_name($name, $context, $check_pages);
        if ($used_reserved) {
            die(json_encode(array('already_in_use' => 1)));
        }
    }
    // die( json_encode( $_POST ) );
    die(json_encode(array('already_in_use' => 0)));
}
开发者ID:torch2424,项目名称:Team-No-Comply-Games-Wordpress,代码行数:28,代码来源:wpcf.php

示例3: wpcf_admin_custom_types_form_submit

/**
 * Submit function
 */
function wpcf_admin_custom_types_form_submit($form)
{
    global $wpcf;
    if (!isset($_POST['ct'])) {
        return false;
    }
    $data = $_POST['ct'];
    $update = false;
    // Sanitize data
    if (isset($data['wpcf-post-type'])) {
        $update = true;
        $data['wpcf-post-type'] = sanitize_title($data['wpcf-post-type']);
    }
    if (isset($data['slug'])) {
        $data['slug'] = sanitize_title($data['slug']);
    }
    if (isset($data['rewrite']['slug'])) {
        $data['rewrite']['slug'] = remove_accents($data['rewrite']['slug']);
        $data['rewrite']['slug'] = strtolower($data['rewrite']['slug']);
        $data['rewrite']['slug'] = trim($data['rewrite']['slug']);
    }
    // Set post type name
    $post_type = '';
    if (!empty($data['slug'])) {
        $post_type = $data['slug'];
    } else {
        if (!empty($data['wpcf-post-type'])) {
            $post_type = $data['wpcf-post-type'];
        } else {
            if (!empty($data['labels']['singular_name'])) {
                $post_type = sanitize_title($data['labels']['singular_name']);
            }
        }
    }
    if (empty($post_type)) {
        wpcf_admin_message(__('Please set post type name', 'wpcf'), 'error');
        //        $form->triggerError();
        return false;
    }
    $data['slug'] = $post_type;
    $custom_types = get_option('wpcf-custom-types', array());
    // Check reserved name
    $reserved = wpcf_is_reserved_name($post_type);
    if (is_wp_error($reserved)) {
        wpcf_admin_message($reserved->get_error_message(), 'error');
        return false;
    }
    // Check overwriting
    if (!$update && array_key_exists($post_type, $custom_types)) {
        wpcf_admin_message(__('Custom post type already exists', 'wpcf'), 'error');
        //            $form->triggerError();
        return false;
    }
    /*
     * Since Types 1.2
     * We do not allow plural and singular names to be same.
     */
    if ($wpcf->post_types->check_singular_plural_match($data)) {
        wpcf_admin_message($wpcf->post_types->message('warning_singular_plural_match'), 'error');
        return false;
    }
    // Check if renaming then rename all post entries and delete old type
    if (!empty($data['wpcf-post-type']) && $data['wpcf-post-type'] != $post_type) {
        global $wpdb;
        $wpdb->update($wpdb->posts, array('post_type' => $post_type), array('post_type' => $data['wpcf-post-type']), array('%s'), array('%s'));
        // Set protected data
        $protected_data_check = $custom_types[$data['wpcf-post-type']];
        // Delete old type
        unset($custom_types[$data['wpcf-post-type']]);
        $data['wpcf-post-type'] = $post_type;
    } else {
        // Set protected data
        $protected_data_check = !empty($custom_types[$post_type]) ? $custom_types[$post_type] : array();
    }
    // Check if active
    if (isset($custom_types[$post_type]['disabled'])) {
        $data['disabled'] = $custom_types[$post_type]['disabled'];
    }
    // Sync taxes with custom taxes
    if (!empty($data['taxonomies'])) {
        $taxes = get_option('wpcf-custom-taxonomies', array());
        foreach ($taxes as $id => $tax) {
            if (array_key_exists($id, $data['taxonomies'])) {
                $taxes[$id]['supports'][$data['slug']] = 1;
            } else {
                unset($taxes[$id]['supports'][$data['slug']]);
            }
        }
        update_option('wpcf-custom-taxonomies', $taxes);
    }
    // Preserve protected data
    foreach ($protected_data_check as $key => $value) {
        if (strpos($key, '_') !== 0) {
            unset($protected_data_check[$key]);
        }
    }
    // Merging protected data
//.........这里部分代码省略.........
开发者ID:adisonc,项目名称:MaineLearning,代码行数:101,代码来源:custom-types-form.php

示例4: save

 /**
  * Summary.
  *
  * Description.
  *
  * @since x.x.x
  * @access (for functions: only use if private)
  *
  * @see Function/method/class relied on
  * @link URL
  * @global type $varname Description.
  * @global type $varname Description.
  *
  * @param type $var Description.
  * @param type $var Optional. Description.
  * @return type Description.
  */
 private function save()
 {
     global $wpcf;
     if (!isset($_POST['ct'])) {
         return false;
     }
     $data = $_POST['ct'];
     $update = false;
     // Sanitize data
     if (isset($data[$this->get_id])) {
         $update = true;
         $data[$this->get_id] = sanitize_title($data[$this->get_id]);
     } else {
         $data[$this->get_id] = null;
     }
     if (isset($data['slug'])) {
         $data['slug'] = sanitize_title($data['slug']);
     } elseif ($_GET['wpcf-post-type'] == 'post' || $_GET['wpcf-post-type'] == 'page' || $_GET['wpcf-post-type'] == 'attachment') {
         $data['slug'] = $_GET['wpcf-post-type'];
     } else {
         $data['slug'] = null;
     }
     if (isset($data['rewrite']['slug'])) {
         $data['rewrite']['slug'] = remove_accents($data['rewrite']['slug']);
         $data['rewrite']['slug'] = strtolower($data['rewrite']['slug']);
         $data['rewrite']['slug'] = trim($data['rewrite']['slug']);
     }
     $data['_builtin'] = false;
     // Set post type name
     $post_type = null;
     if (!empty($data['slug'])) {
         $post_type = $data['slug'];
     } elseif (!empty($data[$this->get_id])) {
         $post_type = $data[$this->get_id];
     } elseif (!empty($data['labels']['singular_name'])) {
         $post_type = sanitize_title($data['labels']['singular_name']);
     }
     if (empty($post_type)) {
         wpcf_admin_message(__('Please set post type name', 'wpcf'), 'error');
         return false;
     }
     $data['slug'] = $post_type;
     $custom_types = get_option(WPCF_OPTION_NAME_CUSTOM_TYPES, array());
     $protected_data_check = array();
     if (wpcf_is_builtin_post_types($data['slug'])) {
         $data['_builtin'] = true;
         $update = true;
     } else {
         // Check reserved name
         $reserved = wpcf_is_reserved_name($post_type, 'post_type');
         if (is_wp_error($reserved)) {
             wpcf_admin_message($reserved->get_error_message(), 'error');
             return false;
         }
         // Check overwriting
         if ((!array_key_exists($this->get_id, $data) || $data[$this->get_id] != $post_type) && array_key_exists($post_type, $custom_types)) {
             wpcf_admin_message(__('Post Type already exists', 'wpcf'), 'error');
             return false;
         }
         /*
          * Since Types 1.2
          * We do not allow plural and singular names to be same.
          */
         if ($wpcf->post_types->check_singular_plural_match($data)) {
             wpcf_admin_message($wpcf->post_types->message('warning_singular_plural_match'), 'error');
             return false;
         }
         // Check if renaming then rename all post entries and delete old type
         if (!empty($data[$this->get_id]) && $data[$this->get_id] != $post_type) {
             global $wpdb;
             $wpdb->update($wpdb->posts, array('post_type' => $post_type), array('post_type' => $data[$this->get_id]), array('%s'), array('%s'));
             /**
              * update post meta "_wp_types_group_post_types"
              */
             $sql = $wpdb->prepare(sprintf('select meta_id, meta_value from %s where meta_key = %%s', $wpdb->postmeta), '_wp_types_group_post_types');
             $all_meta = $wpdb->get_results($sql, OBJECT_K);
             $re = sprintf('/,%s,/', $data[$this->get_id]);
             foreach ($all_meta as $meta) {
                 if (!preg_match($re, $meta->meta_value)) {
                     continue;
                 }
                 $wpdb->update($wpdb->postmeta, array('meta_value' => preg_replace($re, ',' . $post_type . ',', $meta->meta_value)), array('meta_id' => $meta->meta_id), array('%s'), array('%d'));
             }
//.........这里部分代码省略.........
开发者ID:axeljohansson1988,项目名称:oddcv,代码行数:101,代码来源:class.types.admin.edit.post.type.php

示例5: save

 /**
  * Summary.
  *
  * Description.
  *
  * @since x.x.x
  * @access (for functions: only use if private)
  *
  * @see Function/method/class relied on
  * @link URL
  * @global type $varname Description.
  * @global type $varname Description.
  *
  * @param type $var Description.
  * @param type $var Optional. Description.
  * @return type Description.
  */
 private function save()
 {
     if (!isset($_POST['ct'])) {
         return false;
     }
     $data = $_POST['ct'];
     $update = false;
     // Sanitize data
     if (isset($data[$this->get_id])) {
         $update = true;
         $data[$this->get_id] = sanitize_title($data[$this->get_id]);
     }
     if (isset($data['slug'])) {
         $data['slug'] = sanitize_title($data['slug']);
     }
     if (isset($data['rewrite']['slug'])) {
         $data['rewrite']['slug'] = remove_accents($data['rewrite']['slug']);
         $data['rewrite']['slug'] = strtolower($data['rewrite']['slug']);
         $data['rewrite']['slug'] = trim($data['rewrite']['slug']);
     }
     // Set tax name
     $tax = '';
     if (!empty($data['slug'])) {
         $tax = $data['slug'];
     } else {
         if (!empty($data[$this->get_id])) {
             $tax = $data[$this->get_id];
         } else {
             if (!empty($data['labels']['singular_name'])) {
                 $tax = sanitize_title($data['labels']['singular_name']);
             }
         }
     }
     if (empty($tax)) {
         wpcf_admin_message(__('Please set taxonomy name', 'wpcf'), 'error');
         return false;
     }
     if (empty($data['labels']['singular_name'])) {
         $data['labels']['singular_name'] = $tax;
     }
     $data['slug'] = $tax;
     $taxonomies = $this->taxonomies->get();
     /**
      * is built-in?
      */
     $tax_is_built_in = wpcf_is_builtin_taxonomy($tax);
     // Check reserved name
     $reserved = wpcf_is_reserved_name($tax, 'taxonomy') && !$tax_is_built_in;
     if (is_wp_error($reserved)) {
         wpcf_admin_message($reserved->get_error_message(), 'error');
         return false;
     }
     // Check if exists
     if ($update && !array_key_exists($data[$this->get_id], $taxonomies)) {
         wpcf_admin_message(__("Taxonomy do not exist", 'wpcf'), 'error');
         return false;
     }
     // Check overwriting
     if (!$update && array_key_exists($tax, $taxonomies)) {
         /**
          * set last edit author
          */
         $data[WPCF_AUTHOR] = get_current_user_id();
         wpcf_admin_message(__('Taxonomy already exists', 'wpcf'), 'error');
         return false;
     }
     // Check if our tax overwrites some tax outside
     $tax_exists = get_taxonomy($tax);
     if (!$update && !empty($tax_exists)) {
         wpcf_admin_message(__('Taxonomy already exists', 'wpcf'), 'error');
         return false;
     }
     // Check if renaming
     if (!$tax_is_built_in && $update && $data[$this->get_id] != $tax) {
         global $wpdb;
         $wpdb->update($wpdb->term_taxonomy, array('taxonomy' => esc_sql($tax)), array('taxonomy' => esc_sql($data[$this->get_id])), array('%s'), array('%s'));
         // Sync action
         do_action('wpcf_taxonomy_renamed', $tax, $data[$this->get_id]);
         // Delete old type
         unset($taxonomies[$data[$this->get_id]]);
     }
     // Check if active
     if (isset($taxonomies[$tax]['disabled'])) {
//.........这里部分代码省略.........
开发者ID:phuocdungit,项目名称:fundy,代码行数:101,代码来源:class.types.admin.edit.taxonomy.php

示例6: wpcf_admin_custom_types_form_submit

/**
 * Submit function
 */
function wpcf_admin_custom_types_form_submit($form)
{
    global $wpcf;
    if (!isset($_POST['ct'])) {
        return false;
    }
    $data = $_POST['ct'];
    $update = false;
    // Sanitize data
    if (isset($data['wpcf-post-type'])) {
        $update = true;
        $data['wpcf-post-type'] = sanitize_title($data['wpcf-post-type']);
    } else {
        $data['wpcf-post-type'] = null;
    }
    if (isset($data['slug'])) {
        $data['slug'] = sanitize_title($data['slug']);
    } else {
        $data['slug'] = null;
    }
    if (isset($data['rewrite']['slug'])) {
        $data['rewrite']['slug'] = remove_accents($data['rewrite']['slug']);
        $data['rewrite']['slug'] = strtolower($data['rewrite']['slug']);
        $data['rewrite']['slug'] = trim($data['rewrite']['slug']);
    }
    // Set post type name
    $post_type = null;
    if (!empty($data['slug'])) {
        $post_type = $data['slug'];
    } elseif (!empty($data['wpcf-post-type'])) {
        $post_type = $data['wpcf-post-type'];
    } elseif (!empty($data['labels']['singular_name'])) {
        $post_type = sanitize_title($data['labels']['singular_name']);
    }
    if (empty($post_type)) {
        wpcf_admin_message(__('Please set post type name', 'wpcf'), 'error');
        return false;
    }
    $data['slug'] = $post_type;
    $custom_types = get_option('wpcf-custom-types', array());
    // Check reserved name
    $reserved = wpcf_is_reserved_name($post_type, 'post_type');
    if (is_wp_error($reserved)) {
        wpcf_admin_message($reserved->get_error_message(), 'error');
        return false;
    }
    // Check overwriting
    if ((!array_key_exists('wpcf-post-type', $data) || $data['wpcf-post-type'] != $post_type) && array_key_exists($post_type, $custom_types)) {
        wpcf_admin_message(__('Custom post type already exists', 'wpcf'), 'error');
        return false;
    }
    /*
     * Since Types 1.2
     * We do not allow plural and singular names to be same.
     */
    if ($wpcf->post_types->check_singular_plural_match($data)) {
        wpcf_admin_message($wpcf->post_types->message('warning_singular_plural_match'), 'error');
        return false;
    }
    // Check if renaming then rename all post entries and delete old type
    if (!empty($data['wpcf-post-type']) && $data['wpcf-post-type'] != $post_type) {
        global $wpdb;
        $wpdb->update($wpdb->posts, array('post_type' => $post_type), array('post_type' => $data['wpcf-post-type']), array('%s'), array('%s'));
        /**
         * update post meta "_wp_types_group_post_types"
         */
        $sql = sprintf('select meta_id, meta_value from %s where meta_key = \'%s\'', $wpdb->postmeta, '_wp_types_group_post_types');
        $all_meta = $wpdb->get_results($sql, OBJECT_K);
        $re = sprintf('/,%s,/', $data['wpcf-post-type']);
        foreach ($all_meta as $meta) {
            if (!preg_match($re, $meta->meta_value)) {
                continue;
            }
            $wpdb->update($wpdb->postmeta, array('meta_value' => preg_replace($re, ',' . $post_type . ',', $meta->meta_value)), array('meta_id' => $meta->meta_id), array('%s'), array('%d'));
        }
        /**
         * update _wpcf_belongs_{$data['wpcf-post-type']}_id
         */
        $wpdb->update($wpdb->postmeta, array('meta_key' => sprintf('_wpcf_belongs_%s_id', $post_type)), array('meta_key' => sprintf('_wpcf_belongs_%s_id', $data['wpcf-post-type'])), array('%s'), array('%s'));
        /**
         * update options "wpv_options"
         */
        $wpv_options = get_option('wpv_options', true);
        if (is_array($wpv_options)) {
            $re = sprintf('/(views_template_(archive_)?for_)%s/', $data['wpcf-post-type']);
            foreach ($wpv_options as $key => $value) {
                if (!preg_match($re, $key)) {
                    continue;
                }
                unset($wpv_options[$key]);
                $key = preg_replace($re, "\$1" . $post_type, $key);
                $wpv_options[$key] = $value;
            }
            update_option('wpv_options', $wpv_options);
        }
        /**
         * update option "wpcf-custom-taxonomies"
//.........这里部分代码省略.........
开发者ID:sandum150,项目名称:cheltuieli,代码行数:101,代码来源:custom-types-form.php

示例7: wpcf_admin_custom_taxonomies_form_submit

/**
 * Submit function
 *
 * @global object $wpdb
 *
 */
function wpcf_admin_custom_taxonomies_form_submit($form)
{
    if (!isset($_POST['ct'])) {
        return false;
    }
    $data = $_POST['ct'];
    $update = false;
    // Sanitize data
    if (isset($data['wpcf-tax'])) {
        $update = true;
        $data['wpcf-tax'] = sanitize_title($data['wpcf-tax']);
    }
    if (isset($data['slug'])) {
        $data['slug'] = sanitize_title($data['slug']);
    }
    if (isset($data['rewrite']['slug'])) {
        $data['rewrite']['slug'] = remove_accents($data['rewrite']['slug']);
        $data['rewrite']['slug'] = strtolower($data['rewrite']['slug']);
        $data['rewrite']['slug'] = trim($data['rewrite']['slug']);
    }
    // Set tax name
    $tax = '';
    if (!empty($data['slug'])) {
        $tax = $data['slug'];
    } else {
        if (!empty($data['wpcf-tax'])) {
            $tax = $data['wpcf-tax'];
        } else {
            if (!empty($data['labels']['singular_name'])) {
                $tax = sanitize_title($data['labels']['singular_name']);
            }
        }
    }
    if (empty($tax)) {
        wpcf_admin_message(__('Please set taxonomy name', 'wpcf'), 'error');
        return false;
    }
    if (empty($data['labels']['singular_name'])) {
        $data['labels']['singular_name'] = $tax;
    }
    $data['slug'] = $tax;
    $custom_taxonomies = get_option('wpcf-custom-taxonomies', array());
    // Check reserved name
    $reserved = wpcf_is_reserved_name($tax, 'taxonomy');
    if (is_wp_error($reserved)) {
        wpcf_admin_message($reserved->get_error_message(), 'error');
        return false;
    }
    // Check if exists
    if ($update && !array_key_exists($data['wpcf-tax'], $custom_taxonomies)) {
        wpcf_admin_message(__("Custom taxonomy do not exist", 'wpcf'), 'error');
        return false;
    }
    // Check overwriting
    if (!$update && array_key_exists($tax, $custom_taxonomies)) {
        wpcf_admin_message(__('Custom taxonomy already exists', 'wpcf'), 'error');
        return false;
    }
    // Check if our tax overwrites some tax outside
    $tax_exists = get_taxonomy($tax);
    if (!$update && !empty($tax_exists)) {
        wpcf_admin_message(__('Taxonomy already exists', 'wpcf'), 'error');
        return false;
    }
    // Check if renaming
    if ($update && $data['wpcf-tax'] != $tax) {
        global $wpdb;
        $wpdb->update($wpdb->term_taxonomy, array('taxonomy' => $tax), array('taxonomy' => $data['wpcf-tax']), array('%s'), array('%s'));
        // Sync action
        do_action('wpcf_taxonomy_renamed', $tax, $data['wpcf-tax']);
        // Delete old type
        unset($custom_taxonomies[$data['wpcf-tax']]);
    }
    // Check if active
    if (isset($custom_taxonomies[$tax]['disabled'])) {
        $data['disabled'] = $custom_taxonomies[$tax]['disabled'];
    }
    // Sync with post types
    if (!empty($data['supports'])) {
        $post_types = get_option('wpcf-custom-types', array());
        foreach ($post_types as $id => $type) {
            if (array_key_exists($id, $data['supports'])) {
                if (empty($post_types[$id]['taxonomies'][$data['slug']])) {
                    $post_types[$id][TOOLSET_EDIT_LAST] = time();
                }
                $post_types[$id]['taxonomies'][$data['slug']] = 1;
            } else {
                if (!empty($post_types[$id]['taxonomies'][$data['slug']])) {
                    $post_types[$id][TOOLSET_EDIT_LAST] = time();
                }
                unset($post_types[$id]['taxonomies'][$data['slug']]);
            }
        }
        update_option('wpcf-custom-types', $post_types);
//.........这里部分代码省略.........
开发者ID:santikrass,项目名称:apache,代码行数:101,代码来源:custom-taxonomies-form.php


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