Skip to content

Instantly share code, notes, and snippets.

@hivepress
Created July 17, 2024 23:59
Show Gist options
  • Save hivepress/ec55e87227321fcf1b38fdceaa93d47c to your computer and use it in GitHub Desktop.
Save hivepress/ec55e87227321fcf1b38fdceaa93d47c to your computer and use it in GitHub Desktop.
Allow selecting multiple categories in the back-end listing form #hivepress #listings
<?php
add_filter(
'hivepress/v1/meta_boxes/listing_attributes',
function( $meta_box ) {
if ( isset( $meta_box['fields']['categories'] ) ) {
$meta_box['fields']['categories']['multiple'] = true;
unset( $meta_box['fields']['categories']['attributes']['data-multistep'] );
}
return $meta_box;
},
1000
);
@hivepress
Copy link
Author

Yes, please check this topic https://community.hivepress.io/t/create-listing-with-multiple-categories-on-front-end/12384 Please note that allowing multiple categories may break some features (e.g. in Paid Listings) because a single category is assumed per listing in a few extensions, categories are used like distinct listing types.

@PhantomFreelance
Copy link

Amazing thank you. I'm not using paid listings so should be good, but I'll test it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment