If I take the value sanitize_callback out of the argument array
completely, everything works as desired, so error-free.
Yes, and that’s because you used the wrong callable syntax which then causes PHP to use a global function named sanitize_options
instead of the method/function of the same name in your class (i.e. Faqdesk_Settings::sanitize_options()
).
So to solve the problem, in Faqdesk_Settings::initialize_general_options()
, just replace the 'sanitize_options'
with array( $this, 'sanitize_options' )
, like so:
register_setting(
'faqdesk_general_options', //Group Name
'faqdesk_general_options', //Name of the option
array(
'type' => 'array',
'sanitize_callback' => array( $this, 'sanitize_options' ),
)
);