Komunikaty o statusie formularz ustawień WordPress

function change( $data ) {
 
    $message = null;
    $type = null;
 
    if ( null != $data ) {
 
        if ( false === get_option( 'myOption' ) ) {
 
            add_option( 'myOption', $data );
            $type = 'updated';
            $message = __( 'Successfully saved', 'my-text-domain' );
 
        } else {
 
            update_option( 'myOption', $data );
            $type = 'updated';
            $message = __( 'Successfully updated', 'my-text-domain' );
 
        }
 
    } else {
 
        $type = 'error';
        $message = __( 'Data can not be empty', 'my-text-domain' );
 
    }
 
    add_settings_error(
        'myUniqueIdentifyer',
        esc_attr( 'settings_updated' ),
        $message,
        $type
    );
 
}
devasghar