Move attribute field right beneath category field

Hi,

I’d like to move a certain attribute right beneath the main category field. I’ve managed to do it for two attributes in two different categories using the code snippet below:

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

But it won’t let me do in other attributes and categories. Why could that be? I want the attribute to be between the Category and Images fields.

Ok. Solved it by ny making ‘field names’ simpler. I was using ‘subcategory_businesses’, ‘subcategory_venues’ etc. Dropping the ‘subcategories’ part seems to have fixed the issue.

1 Like