Title: qsm_extra_setting_fields
Last modified: December 15, 2022

---

# qsm_extra_setting_fields

 *  Resolved [arijitsom99](https://wordpress.org/support/users/arijitsom99/)
 * (@arijitsom99)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/qsm_extra_setting_fields/)
 * Hello Team,
 * below code is not working, i wanted to create custom field in option page of 
   QSM plugin using “qsm_extra_setting_fields” hook
 * Here is my code, please give me solution regarding below code
 *     ```wp-block-code
       function qsm_percentage_field(){
           global $mlwQuizMasterNext;
   
           $field_array = array(
   
               'id'      => 'passing_percentage',
               'label'   => __( 'Passing Percentage', 'quiz-master-next' ),
               'type'    => 'number',
               'default' => isset( get_option( 'qsm-quiz-settings' )['passing_percentage'] ) ? get_option( 'qsm-quiz-settings' )['passing_percentage'] : 70,
               'help'    => __( 'Set passing percentage', 'quiz-master-next' ),
           );
       $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
   
       }
       add_action('qsm_extra_setting_fields', 'qsm_percentage_field');
       ```
   

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [sumitsanadhya](https://wordpress.org/support/users/sumitsanadhya/)
 * (@sumitsanadhya)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/qsm_extra_setting_fields/#post-16295156)
 * Hi [@arijitsom99](https://wordpress.org/support/users/arijitsom99/)
 * I need to discuss this with my development team. Hopefully, I will get back to
   you with the solution.
 * Regards,
   Sumit
 *  [sumitsanadhya](https://wordpress.org/support/users/sumitsanadhya/)
 * (@sumitsanadhya)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/qsm_extra_setting_fields/#post-16308513)
 * Hi [@arijitsom99](https://wordpress.org/support/users/arijitsom99/)
 * Please use the below-given code and then check.
 *     ```wp-block-code
       function qsm_add_percentage_field(){
           global $mlwQuizMasterNext;
           $field_array = array(
               'id'         => 'passing_percentage',
               'label'      => __( 'Passing Percentage', 'quiz-master-next' ),
               'type'       => 'number',
               'default'    => isset( get_option( 'qsm-quiz-settings' )['passing_percentage'] ) ? get_option( 'qsm-quiz-settings' )['passing_percentage'] : 70,
               'help'       => __( 'Set passing percentage', 'quiz-master-next' ),
               'option_tab' => 'display',
           );
           $mlwQuizMasterNext->pluginHelper->register_quiz_setting( $field_array, 'quiz_options' );
       }
       add_action('admin_init', 'qsm_add_percentage_field');
       ```
   
 * Let me know if need more help on this issue.
   Regards,Sumit
 *  Thread Starter [arijitsom99](https://wordpress.org/support/users/arijitsom99/)
 * (@arijitsom99)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/qsm_extra_setting_fields/#post-16308783)
 * Hello,
   Thank you for the reply.
 * I tried your code with using the ‘admin_init’ hook but it is not working, I assume
   to add custom option in the Quiz we have to rely on the hook provided by Plugin
   which is ‘qsm_extra_setting_fields’. Do you have any update on this particular
   hook?
 *  [sumitsanadhya](https://wordpress.org/support/users/sumitsanadhya/)
 * (@sumitsanadhya)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/qsm_extra_setting_fields/#post-16311916)
 * Hi [@arijitsom99](https://wordpress.org/support/users/arijitsom99/)
 * The code is working properly please check below-given screencast link for your
   reference.
   [Screencast](https://t1868024.p.clickup-attachments.com/t1868024/91c45831-1f6e-4fbe-95e5-e0687ada563c/Desktop-1671681967184.webm?view=open)
   Regards,Sumit

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘qsm_extra_setting_fields’ is closed to new replies.

 * ![](https://ps.w.org/quiz-master-next/assets/icon-128x128.png?rev=3158087)
 * [Quiz and Survey Master (QSM) - Easy Quiz and Survey Maker](https://wordpress.org/plugins/quiz-master-next/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/quiz-master-next/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/quiz-master-next/)
 * [Active Topics](https://wordpress.org/support/plugin/quiz-master-next/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/quiz-master-next/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/quiz-master-next/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [sumitsanadhya](https://wordpress.org/support/users/sumitsanadhya/)
 * Last activity: [3 years, 5 months ago](https://wordpress.org/support/topic/qsm_extra_setting_fields/#post-16311916)
 * Status: resolved