I've added ACF to our existing site which is using a highly customized child theme.
On my new field group I set the location rule as Post Taxonomy which is equal to the product_tag value ("classic"). However, these custom fields are not displaying or present.
I thought that custom fields could be enabled via "screen options" however screen options is not present on the product_tag taxonomy page.
I also disabled all plugins with the exception of elementor, ACF and woocommerce. Also with the same result.
Any ideas on how to resolved this?
I was able to create a solution that would add custom meta via functions.php to woocommerce product tags and categories.
add_action('product_tag_add_form_fields', 'dr_taxonomy_add_new_meta_field', 10, 1);
add_action('product_tag_edit_form_fields', 'dr_taxonomy_edit_meta_field', 10, 1);
//Product Tag Create page
function dr_taxonomy_add_new_meta_field() {
?>
<div class="form-field">
<label for="dr_elementor_template"><?php _e('Elementor Shortcode', 'wh'); ?></label>
<input type="text" name="dr_elementor_template" id="dr_elementor_template">
</div>
<?php
}
//Product Tag Edit page
function dr_taxonomy_edit_meta_field($term) {
$term_id = $term->term_id;
$dr_elementor_template = get_term_meta($term_id, 'dr_elementor_template', true);
?>
<tr class="form-field">
<th scope="row" valign="top"><label for="dr_elementor_template"><?php _e('Elementor Shortcode', 'wh'); ?></label></th>
<td>
<input type="text" name="dr_elementor_template" id="dr_elementor_template" value="<?php echo esc_attr($dr_elementor_template) ? esc_attr($dr_elementor_template) : ''; ?>">
</td>
</tr>
<?php
}
add_action('edited_product_tag', 'dr_save_taxonomy_custom_meta', 10, 1);
add_action('create_product_tag', 'dr_save_taxonomy_custom_meta', 10, 1);
// Save extra taxonomy fields callback function.
function dr_save_taxonomy_custom_meta($term_id) {
$dr_elementor_template = filter_input(INPUT_POST, 'dr_elementor_template');
update_term_meta($term_id, 'dr_elementor_template', $dr_elementor_template);
}
Where the taxonomy term slug that is associated with the taxonomy could be: Post Categories => category, Post Tag => post_tag, WC Product Categories => product_cat, WC Product Tags => product_tag