Title: WP_REST_Server::get_index
Published: December 9, 2015
Last modified: August 20, 2026

---

# WP_REST_Server::get_index( WP_REST_Request $request ): 󠀁[WP_REST_Response](https://developer.wordpress.org/reference/classes/wp_rest_response/)󠁿

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_rest_server/get_index/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/wp_rest_server/get_index/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_rest_server/get_index/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_rest_server/get_index/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/classes/wp_rest_server/get_index/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/classes/wp_rest_server/get_index/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_rest_server/get_index/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_rest_server/get_index/?output_format=md#wp--skip-link--target)

Retrieves the site index.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_rest_server/get_index/?output_format=md#description)󠁿

This endpoint describes the capabilities of the site.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_rest_server/get_index/?output_format=md#parameters)󠁿

 `$request`[WP_REST_Request](https://developer.wordpress.org/reference/classes/wp_rest_request/)
required

Request data.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_rest_server/get_index/?output_format=md#return)󠁿

 [WP_REST_Response](https://developer.wordpress.org/reference/classes/wp_rest_response/)
The API root index data.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_rest_server/get_index/?output_format=md#source)󠁿

    ```php
    public function get_index( $request ) {
    	// General site data.
    	$available = array(
    		'name'            => get_option( 'blogname' ),
    		'description'     => get_option( 'blogdescription' ),
    		'url'             => get_option( 'siteurl' ),
    		'home'            => home_url(),
    		'gmt_offset'      => get_option( 'gmt_offset' ),
    		'timezone_string' => get_option( 'timezone_string' ),
    		'page_for_posts'  => (int) get_option( 'page_for_posts' ),
    		'page_on_front'   => (int) get_option( 'page_on_front' ),
    		'show_on_front'   => get_option( 'show_on_front' ),
    		'namespaces'      => array_keys( $this->namespaces ),
    		'authentication'  => array(),
    		'routes'          => $this->get_data_for_routes( $this->get_routes(), $request['context'] ),
    	);

    	// Add media processing settings for users who can upload files.
    	if ( wp_is_client_side_media_processing_enabled() && current_user_can( 'upload_files' ) ) {
    		// Image sizes keyed by name for client-side media processing.
    		$available['image_sizes'] = array();
    		foreach ( wp_get_registered_image_subsizes() as $name => $size ) {
    			$available['image_sizes'][ $name ] = $size;
    		}

    		/** This filter is documented in wp-admin/includes/image.php */
    		$available['image_size_threshold'] = (int) apply_filters( 'big_image_size_threshold', 2560, array( 0, 0 ), '', 0 );

    		/** This filter is documented in wp-includes/class-wp-image-editor-imagick.php */
    		$available['image_strip_meta'] = (bool) apply_filters( 'image_strip_meta', true );

    		/*
    		 * On the server, this filter receives the decoded image's actual bit depth.
    		 * The client path never decodes the image on the server, so the filter is
    		 * applied with 16 (the maximum depth the client encoder can produce) as
    		 * both the value and the current depth. The client caps its output bit
    		 * depth at the filtered value, so a plugin lowering it (e.g. to 8) takes
    		 * effect on client-generated images too.
    		 */
    		/** This filter is documented in wp-includes/class-wp-image-editor-imagick.php */
    		$available['image_max_bit_depth'] = (int) apply_filters( 'image_max_bit_depth', 16, 16 );
    	}

    	$response = new WP_REST_Response( $available );

    	$fields = $request['_fields'] ?? '';
    	$fields = wp_parse_list( $fields );
    	if ( empty( $fields ) ) {
    		$fields[] = '_links';
    	}

    	if ( $request->has_param( '_embed' ) ) {
    		$fields[] = '_embedded';
    	}

    	if ( rest_is_field_included( '_links', $fields ) || rest_is_field_included( '_embedded', $fields ) ) {
    		$response->add_link( 'help', 'https://developer.wordpress.org/rest-api/' );
    		$this->add_active_theme_link_to_index( $response );
    		$this->add_site_logo_to_index( $response );
    		$this->add_site_icon_to_index( $response );
    	} else {
    		if ( rest_is_field_included( 'site_logo', $fields ) ) {
    			$this->add_site_logo_to_index( $response );
    		}
    		if ( rest_is_field_included( 'site_icon', $fields ) || rest_is_field_included( 'site_icon_url', $fields ) ) {
    			$this->add_site_icon_to_index( $response );
    		}
    	}

    	/**
    	 * Filters the REST API root index data.
    	 *
    	 * This contains the data describing the API. This includes information
    	 * about supported authentication schemes, supported namespaces, routes
    	 * available on the API, and a small amount of data about the site.
    	 *
    	 * @since 4.4.0
    	 * @since 6.0.0 Added `$request` parameter.
    	 *
    	 * @param WP_REST_Response $response Response data.
    	 * @param WP_REST_Request  $request  Request data.
    	 */
    	return apply_filters( 'rest_index', $response, $request );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api/class-wp-rest-server.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/rest-api/class-wp-rest-server.php#L1360)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/rest-api/class-wp-rest-server.php#L1360-L1443)

## 󠀁[Hooks](https://developer.wordpress.org/reference/classes/wp_rest_server/get_index/?output_format=md#hooks)󠁿

 [apply_filters( ‘big_image_size_threshold’, int $threshold, array $imagesize, string $file, int $attachment_id )](https://developer.wordpress.org/reference/hooks/big_image_size_threshold/)

Filters the “BIG image” threshold value.

 [apply_filters( ‘image_max_bit_depth’, int $max_depth, int $image_depth )](https://developer.wordpress.org/reference/hooks/image_max_bit_depth/)

Filters the maximum bit depth of resized images.

 [apply_filters( ‘image_strip_meta’, bool $strip_meta )](https://developer.wordpress.org/reference/hooks/image_strip_meta/)

Filters whether to strip metadata from images when they’re resized.

 [apply_filters( ‘rest_index’, WP_REST_Response $response, WP_REST_Request $request )](https://developer.wordpress.org/reference/hooks/rest_index/)

Filters the REST API root index data.

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_rest_server/get_index/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_is_client_side_media_processing_enabled()](https://developer.wordpress.org/reference/functions/wp_is_client_side_media_processing_enabled/)`wp-includes/media.php` |

Checks whether client-side media processing is enabled.

  | 
| [WP_REST_Server::add_site_icon_to_index()](https://developer.wordpress.org/reference/classes/wp_rest_server/add_site_icon_to_index/)`wp-includes/rest-api/class-wp-rest-server.php` |

Exposes the site icon through the WordPress REST API.

  | 
| [WP_REST_Server::add_site_logo_to_index()](https://developer.wordpress.org/reference/classes/wp_rest_server/add_site_logo_to_index/)`wp-includes/rest-api/class-wp-rest-server.php` |

Exposes the site logo through the WordPress REST API.

  | 
| [WP_REST_Server::add_active_theme_link_to_index()](https://developer.wordpress.org/reference/classes/wp_rest_server/add_active_theme_link_to_index/)`wp-includes/rest-api/class-wp-rest-server.php` |

Adds a link to the active theme for users who have proper permissions.

  | 
| [wp_get_registered_image_subsizes()](https://developer.wordpress.org/reference/functions/wp_get_registered_image_subsizes/)`wp-includes/media.php` |

Returns a normalized list of all currently registered image sub-sizes.

  | 
| [rest_is_field_included()](https://developer.wordpress.org/reference/functions/rest_is_field_included/)`wp-includes/rest-api.php` |

Given an array of fields to include in a response, some of which may be `nested.fields`, determine whether the provided field should be included in the response body.

  | 
| [wp_parse_list()](https://developer.wordpress.org/reference/functions/wp_parse_list/)`wp-includes/functions.php` |

Converts a comma- or space-separated list of scalar values to an array.

  | 
| [WP_REST_Server::get_data_for_routes()](https://developer.wordpress.org/reference/classes/wp_rest_server/get_data_for_routes/)`wp-includes/rest-api/class-wp-rest-server.php` |

Retrieves the publicly-visible data for routes.

  | 
| [WP_REST_Server::get_routes()](https://developer.wordpress.org/reference/classes/wp_rest_server/get_routes/)`wp-includes/rest-api/class-wp-rest-server.php` |

Retrieves the route map.

  | 
| [current_user_can()](https://developer.wordpress.org/reference/functions/current_user_can/)`wp-includes/capabilities.php` |

Returns whether the current user has the specified capability.

  | 
| [home_url()](https://developer.wordpress.org/reference/functions/home_url/)`wp-includes/link-template.php` |

Retrieves the URL for the current site where the front end is accessible.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  | 
| [get_option()](https://developer.wordpress.org/reference/functions/get_option/)`wp-includes/option.php` |

Retrieves an option value based on an option name.

  |

[Show 8 more](https://developer.wordpress.org/reference/classes/wp_rest_server/get_index/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_rest_server/get_index/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_rest_server/get_index/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_rest_server%2Fget_index%2F)
before being able to contribute a note or feedback.