Increase number of tags allowed

Hey,

I tried using an old snippet @yevhen shared to change the maximum number of tags allowed, but it doesn’t seem to be working…

add_filter(
	'hivepress/v1/models/listing/attributes',
	function( $attributes ) {
		if ( isset( $attributes['tags'] ) ) {
			$attributes['tags']['edit_field'] = array_merge(
			$attributes['tags']['edit_field'],
			[
				'max_values' => 20,
			]
			);
		}
 
		return $attributes;
	},
	1000
);

Much appreciated if you’re able to help make this work! :slight_smile:

Cheers,
Chris :victory_hand:

Hi,

Please try this code snippet instead:

add_filter(
	'hivepress/v1/models/listing/attributes',
	function ( $attributes ) {
		if ( isset( $attributes['tags'] ) ) {
			$attributes['tags']['edit_field']['max_values'] = 20;
		}

		return $attributes;
	},
	1000
);

add_filter(
	'hivepress/v1/models/listing',
	function ( $model ) {
		if ( isset( $model['fields']['tags'] ) ) {
			$model['fields']['tags']['max_values'] = 20;
		}

		return $model;
	},
	1000
);
2 Likes

As always, many thanks for your help, @ihor! - You’re a legend.

Cheers,
Chris :victory_hand:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.