• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Jetpack a2z

Jetpack a2z

Jetpack a2z

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / Jetpack_Sitemap_Librarian::read_sitemap_data() – Retrieve a single sitemap with given name and type.

You appear to be a bot. Output may be restricted

Description

Retrieve a single sitemap with given name and type.

Returns null if no such sitemap exists.

Usage

$array = Jetpack_Sitemap_Librarian::read_sitemap_data( $name, $type );

Parameters

$name
( string ) required – Name of the sitemap to be retrieved.
$type
( string ) required – Type of the sitemap to be retrieved.
$id
( int ) required – ID number of the sitemap in the database.
$timestamp
( string ) required – Most recent timestamp of the resources pointed to.
$name
( string ) required – Name of the sitemap in the database.
$type
( string ) required – Type of the sitemap in the database.
$text
( string ) required – The content of the sitemap. }

Returns

array $args {

Source

File name: jetpack/modules/sitemaps/sitemap-librarian.php
Lines:

1 to 24 of 24
  public function read_sitemap_data( $name, $type ) {
    $post_array = get_posts(
      array(
        'numberposts' => 1,
        'title'       => $name,
        'post_type'   => $type,
        'post_status' => 'draft',
      )
    );

    $the_post = array_shift( $post_array );

    if ( null === $the_post ) {
      return null;
    } else {
      return array(
        'id'        => $the_post->ID,
        'timestamp' => $the_post->post_date,
        'name'      => $the_post->post_title,
        'type'      => $the_post->post_type,
        'text'      => base64_decode( $the_post->post_content ),
      );
    }
  }
 

 View on GitHub View on Trac

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Pinterest (Opens in new window)

Related

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

Primary Sidebar

Information

Function name: Jetpack_Sitemap_Librarian::read_sitemap_data
Class ref: Jetpack_Sitemap_Librarian
Plugin ref: Jetpack
Version: 9.4
Sourcefile: modules/sitemaps/sitemap-librarian.php
File ref: modules/sitemaps/sitemap-librarian.php
Deprecated?: No
API Letters: J,L,R,S

Footer

Jetpack a2z
Jetpack a2z
Jetpack a2z
WordPress 5.6.2
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:  jetpack.wp-a2z.org
© Copyright Jetpack a2z 2014-2021. All rights reserved.


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

  • Home
  • Blog
  • Sitemap
  • Sites