How to sanitize settings API value
Add a third parameter, which is an $args array, and add your sanitization callback in there: register_setting( ‘sports_api_key’, ‘sports_api_key’, array( ‘sanitization_callback’ => ‘sanitize_text_field’ ) ); This is enough for your use case, the sanitize_text_field function already exists, so you don’t need to create it. More information here for how to add a sanitization callback and … Read more