WP_Sitemaps_Provider::get_sitemap_type_data() – Gets data about each sitemap type.

You appear to be a bot. Output may be restricted

Description

Gets data about each sitemap type.

Usage

$array[] = WP_Sitemaps_Provider::get_sitemap_type_data();

Parameters

Returns

array[] Array of sitemap types including object subtype name and number of pages.

Source

File name: wordpress/wp-includes/sitemaps/class-wp-sitemaps-provider.php


Lines:

1 to 28 of 28
  public function get_sitemap_type_data() {
    $sitemap_data = array();

    $object_subtypes = $this->get_object_subtypes();

    // If there are no object subtypes, include a single sitemap for the
    // entire object type.
    if ( empty( $object_subtypes ) ) {
      $sitemap_data[] = array(
        'name'  => '',
        'pages' => $this->get_max_num_pages(),
      );
      return $sitemap_data;
    }

    // Otherwise, include individual sitemaps for every object subtype.
    foreach ( $object_subtypes as $object_subtype_name => $data ) {
      $object_subtype_name = (string) $object_subtype_name;

      $sitemap_data[] = array(
        'name'  => $object_subtype_name,
        'pages' => $this->get_max_num_pages( $object_subtype_name ),
      );
    }

    return $sitemap_data;
  }
 

 View on GitHub View on Trac