• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Yoast SEO a2z

Yoast SEO a2z

WordPress SEO a2z

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / WPSEO_Sitemaps::build_sitemap() – Attempts to build the requested sitemap.

You appear to be a bot. Output may be restricted

Description

Attempts to build the requested sitemap.

Sets $bad_sitemap if this isn't for the root sitemap, a post type or taxonomy.

Usage

WPSEO_Sitemaps::build_sitemap( $type );

Parameters

$type
( string ) required – The requested sitemap's identifier.

Returns

void

Source

File name: wordpress-seo/inc/sitemaps/class-sitemaps.php
Lines:

1 to 46 of 46
  public function build_sitemap( $type ) {

    
/**
 * Filter the type of sitemap to build.
 *
 * @param string $type Sitemap type, determined by the request.
 */
    $type = apply_filters( 'wpseo_build_sitemap_post_type', $type );

    if ( $type === '1' ) {
      $this->build_root_map();

      return;
    }

    $entries_per_page = $this->get_entries_per_page();

    foreach ( $this->providers as $provider ) {
      if ( ! $provider->handles_type( $type ) ) {
        continue;
      }

      try {
        $links = $provider->get_sitemap_links( $type, $entries_per_page, $this->current_page );
      } catch ( OutOfBoundsException $exception ) {
        $this->bad_sitemap = true;

        return;
      }

      $this->sitemap = $this->renderer->get_sitemap( $links, $type, $this->current_page );

      return;
    }

    if ( has_action( 'wpseo_do_sitemap_' . $type ) ) {
      
/**
 * Fires custom handler, if hooked to generate sitemap for the type.
 */
      do_action( 'wpseo_do_sitemap_' . $type );

      return;
    }

    $this->bad_sitemap = true;
  }
 

 View on GitHub View on Trac

Published: 27th November 2019 | Last updated: 27th November 2019

Primary Sidebar

Information

Function name: WPSEO_Sitemaps::build_sitemap
Class ref: WPSEO_Sitemaps
Plugin ref: Yoast SEO
Version: 15.4
Sourcefile: inc/sitemaps/class-sitemaps.php
File ref: inc/sitemaps/class-sitemaps.php
Deprecated?: No
API Letters: B,S,W

Footer

Yoast SEO a2z
Yoast SEO a2z
WordPress SEO a2z
WordPress 5.6
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  wordpress-seo.wp-a2z.org
© Copyright Yoast SEO a2z 2017-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites