Skip to content

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

Closed

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',
	) );
}

Activity

  1. deeptiboddapati commented on Mar 15, 2018

    @deeptiboddapati

    I just ran into this issue using CMB2 at work. What priority is this for y'all?

  2. jtsternberg commented on Mar 15, 2018

    @jtsternberg
    Member

    @deeptiboddapati This should be fixed. Feel free to test the trunk branch.

  3. added a commit that references this issue on Oct 12, 2026
    6e9424c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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