Skip to content

Instantly share code, notes, and snippets.

@rahularyan
Created December 28, 2020 09:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahularyan/f7ca4e36ecb027e8923503e1ce080e12 to your computer and use it in GitHub Desktop.
Save rahularyan/f7ca4e36ecb027e8923503e1ce080e12 to your computer and use it in GitHub Desktop.
<?php
/**
* Override AnsPress form category field selection list.
*
* @param mixed $form
* @return mixed
*/
function anspress_override_category_field( $form ){
$form['fields']['category'] = array(
'label' => __( 'Category', 'anspress-question-answer' ),
'desc' => __( 'Select a topic that best fits your question.', 'anspress-question-answer' ),
'type' => 'select',
'options' => 'terms',
'order' => 2,
'validate' => 'required,not_zero',
'terms_args' => array(
''
)
);
return $form;
}
add_action( 'ap_question_form_fields', 'anspress_override_category_field', 99999 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment