get_sizes example


    public function get_directory_sizes() {
        if ( ! class_exists( 'WP_Debug_Data' ) ) {
            require_once ABSPATH . 'wp-admin/includes/class-wp-debug-data.php';
        }

        $this->load_admin_textdomain();

        $sizes_data = WP_Debug_Data::get_sizes();
        $all_sizes  = array( 'raw' => 0 );

        foreach ( $sizes_data as $name => $value ) {
            $name = sanitize_text_field( $name );
            $data = array();

            if ( isset( $value['size'] ) ) {
                if ( is_string( $value['size'] ) ) {
                    $data['size'] = sanitize_text_field( $value['size'] );
                } else {
                    $data['size'] = (int) $value['size'];
                }
check_ajax_referer( 'health-check-site-status-result' );

    if ( ! current_user_can( 'view_site_health_checks' ) || is_multisite() ) {
        wp_send_json_error();
    }

    if ( ! class_exists( 'WP_Debug_Data' ) ) {
        require_once ABSPATH . 'wp-admin/includes/class-wp-debug-data.php';
    }

    $sizes_data = WP_Debug_Data::get_sizes();
    $all_sizes  = array( 'raw' => 0 );

    foreach ( $sizes_data as $name => $value ) {
        $name = sanitize_text_field( $name );
        $data = array();

        if ( isset( $value['size'] ) ) {
            if ( is_string( $value['size'] ) ) {
                $data['size'] = sanitize_text_field( $value['size'] );
            } else {
                $data['size'] = (int) $value['size'];
            }
Home | Imprint | This part of the site doesn't use cookies.