1
add_action ( 'edit_category_form_fields', 'tag_category_fields');
add_action ( 'edited_category', 'save_tag_category_fields');
add_action('wp_ajax_my_action', 'tag_category_fields');
function tag_category_fields($tag){
    $t_id = $tag->term_id;
    $tag_items_list = individual_tag();
    $mytags = $_POST['whatever'];
    ?>

    <tr class="form-field">
    <th scope="row" valign="top"><label for="category_tag_list"><?php _e('Available Categary Tags'); ?></label></th>
    <td>
    <form class="category_tag_list_values">
    <select id="list_category_tags" name="list_category_tags" style="width: 300px; padding: 5px; overflow-y: auto;" multiple="multiple">
    <?php foreach($tag_items_list as $tags){ ?>
        <option value="<?php echo $tags->name ?>"><?php echo $tags->name ?></option>
    <?php } ?>    
    </select>
    <br/>
    <input class="uibutton" style="width: 75px" type="button" value="add">
    </form>
    <br />
    </td>
    </tr>
    <tr class="form-field">
    <th scope="row" valign="top"><label for="added_category_tag"><?php _e('Current Category Tags'); ?></label></th>
    <td>
        <input id="mytags" name="mytags" />
        <br />
    </td>
    <input type="hidden" name="listtag1" value="hi" />
    <?php foreach($mytags as $tags){
            echo '<input type="hidden" name="listtag" value="'.$tags.'" />';
            }
        ?>
    </tr>
    <?php
}//add extra fields to category edit form hook


function save_tag_category_fields( $term_id ) {
    if(isset($_POST['listtag'])){
       $value = $_POST['listtag'];
    }
}

So What I'm trying to do is set values with jquery and ajax to set values and then perform actions with them when I save the category edit page but I can't seem to get the value into function save_tag_category_fields( $term_id ) function, help?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.