Support » Plugin: Meta Box - WordPress Custom Fields Framework » Unable to save the Taxonomy values

  • Resolved Swapnil V. Patil

    (@patilswapnilv)


    I am trying to simplify the default meta boxes that handle the custom taxonomies.

    I have custom hierarchical taxonomies for a post type. And each of these taxonomies have a lot of values, as a result of which the user needs to scroll through the default metabox to check the desired values.

    I tried using select advance, to replace the default meta box with a simpler interface, it helps when the values are suggested when the user starts typing. I also have clone set to true, since I need multiple values for each of the taxonomies.

    The problem is, when I select the values I need and save, it does not actually save them to the DB. What did I miss? Am I doing something wrong?

    Here is the code I added to the functions.php for the above mentioned metabox:

    function mdln_get_meta_box( $meta_boxes ) {
    	$prefix = 'mdln-';
    
    	$meta_boxes[] = array(
    		'id' => 'catalog_page',
    		'title' => esc_html__( 'Catalog Attributes', 'mdln-catalog' ),
    		'post_types' => array( 'catalog_page' ),
    		'context' => 'side',
    		'priority' => 'high',
    		'multiple' => true,
    		'autosave' => true,
    		'fields' => array(
    			array(
    				'id' => $prefix . 'catalog_category',
    				'type' => 'taxonomy_advanced',
    				'name' => esc_html__( 'Catalog Category', 'mdln-catalog' ),
    				'desc' => esc_html__( 'Select the catalog category', 'mdln-catalog' ),
    				'taxonomy' => 'catalog_category',
    				'field_type' => 'select_advanced',
    				'clone' => true,
    				'parent' => true,
    				'sort_clone' => true,
    				'add_button' => esc_html__( 'Add another category', 'mdln-catalog' ),
    			),
    			array(
    				'id' => $prefix . 'product_family',
    				'type' => 'taxonomy_advanced',
    				'name' => esc_html__( 'Product Family', 'mdln-catalog' ),
    				'desc' => esc_html__( 'Select the product family', 'mdln-catalog' ),
    				'taxonomy' => 'catalog_productfamily',
    				'field_type' => 'select_advanced',
    				'clone' => true,
    				'parent' => true,
    				'sort_clone' => true,
    				'add_button' => esc_html__( 'Add another Product family', 'mdln-catalog' ),
    			),
    			array(
    				'id' => $prefix . 'catalog_productgroup',
    				'type' => 'taxonomy_advanced',
    				'name' => esc_html__( 'Product Family', 'mdln-catalog' ),
    				'desc' => esc_html__( 'Select the product family', 'mdln-catalog' ),
    				'taxonomy' => 'catalog_productgroup',
    				'field_type' => 'select_advanced',
    				'clone' => true,
    				'parent' => true,
    				'sort_clone' => true,
    				'add_button' => esc_html__( 'Add another Product Group', 'mdln-catalog' ),
    			),
    			array(
    				'id' => $prefix . 'catalog_searchkey',
    				'type' => 'taxonomy_advanced',
    				'name' => esc_html__( 'Product Family', 'mdln-catalog' ),
    				'desc' => esc_html__( 'Select the product family', 'mdln-catalog' ),
    				'taxonomy' => 'catalog_searchkey',
    				'field_type' => 'select_advanced',
    				'clone' => true,
    				'parent' => true,
    				'sort_clone' => true,
    				'add_button' => esc_html__( 'Add another SearchKey', 'mdln-catalog' ),
    			),
    		),
    	);
    
    	return $meta_boxes;
    }
    add_filter( 'rwmb_meta_boxes', 'mdln_get_meta_box' );

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Anh Tran

    (@rilwis)

    Hi,

    I see you’re using taxonomy_advanced field. This field saves the selected term IDs into the post meta in CSV format.

    If you’re looking for a field that sets post terms, then please use taxonomy field.

    For more details, please take a look at taxonomy advanced documentation.

Viewing 1 replies (of 1 total)
  • The topic ‘Unable to save the Taxonomy values’ is closed to new replies.