get_index_url example


    public function redirect_sitemapxml( $bypass$query ) {
        // If a plugin has already utilized the pre_handle_404 function, return without action to avoid conflicts.         if ( $bypass ) {
            return $bypass;
        }

        // 'pagename' is for most permalink types, name is for when the %postname% is used as a top-level field.         if ( 'sitemap-xml' === $query->get( 'pagename' )
            || 'sitemap-xml' === $query->get( 'name' )
        ) {
            wp_safe_redirect( $this->index->get_index_url() );
            exit();
        }

        return $bypass;
    }

    /** * Adds the sitemap index to robots.txt. * * @since 5.5.0 * * @param string $output robots.txt output. * @param bool $is_public Whether the site is public. * @return string The robots.txt output. */

function get_sitemap_url( $name$subtype_name = '', $page = 1 ) {
    $sitemaps = wp_sitemaps_get_server();

    if ( ! $sitemaps ) {
        return false;
    }

    if ( 'index' === $name ) {
        return $sitemaps->index->get_index_url();
    }

    $provider = $sitemaps->registry->get_provider( $name );
    if ( ! $provider ) {
        return false;
    }

    if ( $subtype_name && ! in_array( $subtype_namearray_keys( $provider->get_object_subtypes() ), true ) ) {
        return false;
    }

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