Restrict location for a specific category

hi I wanted to know it is possible to display location for a specific category when adding an ad for example location is displayed only for the category “service”


Please check this topic Show location only for specific categories

​I hope this is helpful to you.

I replaced with the category slug, it gave me a fatal error

$categories = [ 1, 2, 3 ]; by $categories = [ real-estate ];

the code in question

	function( $attributes ) {
		if ( isset( $attributes['location'] ) ) {
			$categories = [ real-estate ];

			$attributes['location']['categories']  = $categories;
			$attributes['latitude']['categories']  = $categories;
			$attributes['longitude']['categories'] = $categories;

		return $attributes;


You need to specify the category ID, and you have specified the slug.

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