Profile photo of Laurent AlquierLaurent Alquier
asked 2 years ago

Is it possible to set a Question category by default in the New Question form?

I would like the selection to be set to ‘Questions’ by default instead of ‘Select a category’,

1 Answers
Dominic
answered 2 years ago

To set a question category by default, you can go to your theme folder and create a new folder , named it dwqa-templates.
Inside your new folder, create a new file: question-submit-form.php.
Now, open up the new file in notepad or any code editor, and copy/paste the code at this link: http://snippi.com/s/b3p4x1w

Then find the line 41:
'selected' => isset( $_POST['question-category'] ) ? $_POST['question-category'] : false,

Replace with the following code:
'selected' => Your Categories ID

Note: You can find your categories ID In backend, when you edit a category, you will see your category ID in the URL on your browser address bar which looks like this: …&tag_ID=

Hope this helps!

Powered by DW Question & Answer Pro

Access years of experience in WordPress; Collaborate with professionals trusted by tens of thousands of people across the world.

Sign Up Today