Set default value for category on submit listing page

Hey,

In order to show all of the available attributes upon landing on the ‘Add Listing’ page, I’d like to set a default category, instead of ‘—’.

I searched the forums and found an old post, but after trying the proposed snippet (below) it doesn’t seem to be working.

add_action(
	'hivepress/v1/models/listing/create', 
	function($listing_id, $listing) {
		$listing->set_categories(1)->save_categories();
	}, 
	1000, 
	2
);

If I can set a default category, I also like to hide the ‘—’

Cheers,
Chris

Hello Chris,

This may help you :

Cheers !

This looks like just what I was after. Thank you very much @condorito.fr - will test out soon! :folded_hands:

Another quick update:

The snippet I found/posted in the OP did seem to work as intended after increasing the priority value in the Code Snippets plugin.

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