Hello,
Could you please tell me if it is possible to add the field “tags” only for a specific category in the listing form ?
Thank you !
Hi,
Please use this PHP snippet:
add_filter(
'hivepress/v1/models/listing/attributes',
function( $attributes ) {
if ( isset($attributes['tags']) ) {
$attributes['tags']['categories'] = [1,2,3];
}
return $attributes;
},
1000
);
Please note that instead of 1,2,3, you need to specify the IDs of the categories that you can view in Listings > Categories > open any category > and the URL will display the ID. You can add this snippet using this documentation: How to add custom code snippets - HivePress Help Center
I hope this is helpful to you.
Hi,
Thank you for your help. Tags are still present in all the categories. Do you have another solution please ?
Thank you very much
Hi,
Please try to create a new listing and check it this way. Because the snippet will only work for new listings.
Hi
I am sorry but it doesn’t work. Do you have another solution please ?
Thank you!
Hi,
Please send temporary WP access to support@hivepress.io with details for reproducing this issue, and we’ll check it (please send only the link, without login and password). You can create a temporary access link using this plugin Temporary Login Without Password – WordPress plugin | WordPress.org.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.