📜  custom-taxonomy-image-option-in-admin-panel - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:14.550000             🧑  作者: Mango

代码示例1
you want to upload image so we create a js file and write some code in functions.php.

But first we create custom upload meta field.

In your function.php or where you write a code for register custom taxonomy and write this code:

First we create custom meta term field

add_action('product_categories_add_form_fields', 'add_term_image', 10, 2);
function add_term_image($taxonomy){
    ?>
    
Same as above write your taxonomy name after created_ in add_action Like created_product_categories Now we create meta term field for edit add_action('product_categories_edit_form_fields', 'edit_image_upload', 10, 2); function edit_image_upload($term, $taxonomy) { // get current group $txt_upload_image = get_term_meta($term->term_id, 'term_image', true); ?>