Sitemaps: Rename wp_get_sitemaps() to wp_get_sitemaps_providers()

Following [48536], rename the function to match the rest of the sitemaps logic.

Also eliminates some dead code after [48523].

Props pbiron.
See #50724. See #50643.

git-svn-id: https://develop.svn.wordpress.org/trunk@48540 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Pascal Birchler
2020-07-21 15:55:21 +00:00
parent 3269e83801
commit 83b94f5cd6
5 changed files with 22 additions and 34 deletions

View File

@@ -22,8 +22,6 @@
function wp_sitemaps_get_server() {
global $wp_sitemaps;
$is_enabled = (bool) get_option( 'blog_public' );
// If there isn't a global instance, set and bootstrap the sitemaps system.
if ( empty( $wp_sitemaps ) ) {
$wp_sitemaps = new WP_Sitemaps();
@@ -51,13 +49,8 @@ function wp_sitemaps_get_server() {
*
* @return WP_Sitemaps_Provider[] Array of sitemap providers.
*/
function wp_get_sitemaps() {
function wp_get_sitemaps_providers() {
$sitemaps = wp_sitemaps_get_server();
if ( ! $sitemaps ) {
return array();
}
return $sitemaps->registry->get_providers();
}
@@ -72,11 +65,6 @@ function wp_get_sitemaps() {
*/
function wp_register_sitemap( $name, WP_Sitemaps_Provider $provider ) {
$sitemaps = wp_sitemaps_get_server();
if ( ! $sitemaps ) {
return false;
}
return $sitemaps->registry->add_provider( $name, $provider );
}

View File

@@ -49,7 +49,7 @@ class WP_Sitemaps_Registry {
* @since 5.5.0
*
* @param string $name Sitemap provider name.
* @return WP_Sitemaps_Provider|null Sitemaps provider if it exists, null otherwise.
* @return WP_Sitemaps_Provider|null Sitemap provider if it exists, null otherwise.
*/
public function get_provider( $name ) {
if ( ! isset( $this->providers[ $name ] ) ) {