Selection of multiple categories and subcategories

I would like to know how to select multiple categories and subcategories for an advertisement

Hi @llu,

I asked a similar question myself a while ago. Whilst this feature isn’t available by default, you can achieve this by using Code Snippets.

^^ See here.

Cheers,
Chris :victory_hand:

1 Like
add_filter( 'hivepress/v1/forms/listing_submit', function( $form ) {

	if ( isset( $form['fields']['categories'] ) ) {
		$form['fields']['categories']['multiple'] = true;

		unset( $form['fields']['categories']['attributes']['data-multistep'] );
	}

	return $form;

}, 1000 );

The only solution I have is this one, and it doesn’t work, probably because of the subcategories

Hi,

Could you please clarify what you mean by “doesn’t work” in this case? I’ve tested it locally, and it allows saving multiple categories and subcategories without any issues: How to enable multiple categories | Loom.

By default, the system is designed to use a single primary category, with additional filtering handled via attributes. The solution provided by Chris enables selecting multiple categories, including subcategories, and saving them correctly. It also works as expected when filtering by categories. But please note that some conflicts may occur [e.g., with the Paid Listings or Memberships plugin when selecting a category is required] because the system is designed to have one primary category.

I’d appreciate any additional details you can share so I can better understand the issue and assist you further.