Skip to content

Selected file/image preview for term meta doesn't clear after saving term at edit-tags.php?taxonomy=TAXONOMY #794

@tw2113

Description

@tw2113

Expected Behavior:

Preview image would be removed after AJAX is done processing the new term addition

Actual Behavior:

Preview image retains, though the text field is cleared.

Steps to reproduce (I have confirmed I can reproduce this issue on the trunk branch):

  1. Use code below for quick setup.
  2. Add an image
  3. Add term
  4. Watch the preview not clear.

CMB2 Field Registration Code:

MAKE SURE TO CHANGE TAXONOMY.

add_action( 'cmb2_admin_init', 'cycle_metabox' );
function cycle_metabox() {
	$adverts_box = new_cmb2_box( array(
		'id'           => $prefix . 'graphic_adverts',
		'object_types' => array( 'term' ),
		'taxonomies'   => array( 'actor-hack' ),
	) );

	$banner_advert_id = $adverts_box->add_field( array(
		'id'          => $prefix . 'graphic_advert',
		'description' => __( 'Used as default adverts for products in this category', 'nnn-products' ),
		'type'        => 'group',
		'options'     => array(
			'group_title'   => __( 'Advert {#}', 'nnn-products' ),
			'add_button'    => __( 'Add Another Advert', 'nnn-products' ),
			'remove_button' => __( 'Remove Advert', 'nnn-products' ),
			'sortable'      => true,
		),
	) );

	$adverts_box->add_group_field( $banner_advert_id, array(
		'name' => __( 'Banner', 'nnn-products' ),
		'id'   => 'banner',
		'type' => 'file',
	) );

	$adverts_box->add_group_field( $banner_advert_id, array(
		'name' => __( 'Link', 'nnn-products' ),
		'id'   => 'link',
		'type' => 'text_url',
	) );
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions