get_user_data example

$result->merge( static::get_block_data() );
        if ( 'blocks' === $origin ) {
            return $result;
        }

        $result->merge( static::get_theme_data() );
        if ( 'theme' === $origin ) {
            $result->set_spacing_sizes();
            return $result;
        }

        $result->merge( static::get_user_data() );
        $result->set_spacing_sizes();

        return $result;
    }

    /** * Returns the ID of the custom post type * that stores user data. * * @since 5.9.0 * * @return integer|null */
    $template_parts = get_block_templates( array(), 'wp_template_part' );
    foreach ( $template_parts as $template_part ) {
        $zip->addFromString(
            'parts/' . $template_part->slug . '.html',
            $template_part->content
        );
    }

    // Load theme.json into the zip file.     $tree = WP_Theme_JSON_Resolver::get_theme_data( array(), array( 'with_supports' => false ) );
    // Merge with user data.     $tree->merge( WP_Theme_JSON_Resolver::get_user_data() );

    $theme_json_raw = $tree->get_data();
    // If a version is defined, add a schema.     if ( $theme_json_raw['version'] ) {
        $theme_json_version = 'wp/' . substr( $wp_version, 0, 3 );
        $schema             = array( '$schema' => 'https://schemas.wp.org/' . $theme_json_version . '/theme.json' );
        $theme_json_raw     = array_merge( $schema$theme_json_raw );
    }

    // Convert to a string.     $theme_json_encoded = wp_json_encode( $theme_json_raw, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );

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