I’ve now added a category to CV, and since there is only one would like to hide the category select option in the add listing form and assign that category automatically. I have written the following code based on this https://wpgeodirectory.com/support/topic/autofill-category/
jQuery(document).ready(function(){
if(location.pathname == “/add-listing/”)
{
$price_id = jQuery(‘[name=”package_id”]:checked’).val();
if($price_id == 5)
{
jQuery(‘#gd_placecategory.chosen_select’).val(’82’).change();
setTimeout(function()
{
jQuery(‘input[name = post_default_category][value = 82]’).attr(“checked”, “checked”);
}, 2000);
}
}
});
It isn’t working 🙁 Does it need to be modified to specify which CPT I’m interested in? (Though I thought this was done by the “price_id” bit). I’ve tried changing #gd_placecategory to #gd_cvcategory but this doesn’t solve the problem.