• Carmelo Baglieri

    (@carmelobaglieri)


    To solve custom meta fields quickly you can add an hook inside terms-edit-form.php

    do_action( "sublanguage_{$taxonomy}_edit_form_fields", $tag, $taxonomy, $language );

    Here is an example for use

    <?php

    function translation_custom_taxonomy_fields( $term, $taxonomy, $language ){

    global $sublanguage;

    // archive title
    $meta_value = $sublanguage->translate_term_meta( $term, 'archive_title', true, $language, '' );
    ?>
    <tr class="form-field">
    <th scope="row" valign="top">
    <label for="archive-title"><?= __('Archive title', DFHR) ?>:</label>
    </th>
    <td>
    <input type="text" name="sublanguage_term[<?php echo $taxonomy; ?>][<?php echo $language->ID; ?>][archive_title]" id="archive-title" value="<?php echo $meta_value; ?>" />
    <p class="description"><?= __('Add page archive title.', DFHR) ?></p>
    </td>
    </tr>

    <?php
    }

    add_action("sublanguage_{$tax}_edit_form_fields", "translation_custom_taxonomy_fields", 20, 3 );

The topic ‘Custom term meta fields’ is closed to new replies.