get_settings_errors example

load_default_textdomain( $user_language_new );
        }
    } else {
        add_settings_error( 'general', 'settings_updated', __( 'Settings save failed.' ), 'error' );
    }

    /* * Handle settings errors and return to options page. */

    // If no settings errors were registered add a general 'updated' message.     if ( ! count( get_settings_errors() ) ) {
        add_settings_error( 'general', 'settings_updated', __( 'Settings saved.' ), 'success' );
    }

    set_transient( 'settings_errors', get_settings_errors(), 30 ); // 30 seconds.
    // Redirect back to the settings page that was submitted.     $goback = add_query_arg( 'settings-updated', 'true', wp_get_referer() );
    wp_redirect( $goback );
    exit;
}


function settings_errors( $setting = '', $sanitize = false, $hide_on_update = false ) {

    if ( $hide_on_update && ! empty( $_GET['settings-updated'] ) ) {
        return;
    }

    $settings_errors = get_settings_errors( $setting$sanitize );

    if ( empty( $settings_errors ) ) {
        return;
    }

    $output = '';

    foreach ( $settings_errors as $key => $details ) {
        if ( 'updated' === $details['type'] ) {
            $details['type'] = 'success';
        }

        

            }
        } elseif ( ! $is_nginx && $htaccess_update_required && ! $writable ) {
            $message = sprintf(
                /* translators: %s: .htaccess */
                __( 'You should update your %s file now.' ),
                '<code>.htaccess</code>'
            );
        }
    }

    if ( ! get_settings_errors() ) {
        add_settings_error( 'general', 'settings_updated', $message, 'success' );
    }

    set_transient( 'settings_errors', get_settings_errors(), 30 ); // 30 seconds.
    wp_redirect( admin_url( 'options-permalink.php?settings-updated=true' ) );
    exit;
}

flush_rewrite_rules();

Home | Imprint | This part of the site doesn't use cookies.