• 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_OpenGraph::publish_date() – Output the article publish and last modification date.

You appear to be a bot. Output may be restricted

Description

Output the article publish and last modification date.

Usage

$boolean; = WPSEO_OpenGraph::publish_date();

Parameters

Returns

boolean;

Source

File name: wordpress-seo/frontend/class-opengraph.php


Lines:

1 to 31 of 31
  public function publish_date() {

    if ( ! is_singular( 'post' ) ) {
      
/**
 * Filter: 'wpseo_opengraph_show_publish_date' - Allow showing publication date for other post types.
 *
 * @api bool $unsigned Whether or not to show publish date.
 *
 * @param string $post_type The current URL's post type.
 */
      if ( false === apply_filters( 'wpseo_opengraph_show_publish_date', false, get_post_type() ) ) {
        return false;
      }
    }

    $post = get_post();

    $pub = $this->date->format( $post->post_date_gmt );
    $this->og_tag( 'article:published_time', $pub );

    $mod = $this->date->format( $post->post_modified_gmt );
    if ( $mod !== $pub ) {
      $this->og_tag( 'article:modified_time', $mod );
      $this->og_tag( 'og:updated_time', $mod );
    }

    return true;
  }
 

 View on GitHub View on Trac

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

Primary Sidebar

Information

Function name: WPSEO_OpenGraph::publish_date
Class ref: WPSEO_OpenGraph
Plugin ref: Yoast SEO
Version: 12.6.2
Sourcefile: frontend/class-opengraph.php
File ref: frontend/class-opengraph.php
Deprecated?: No
API Letters: D,O,P,W

Footer

Yoast SEO a2z Yoast SEO a2z
WordPress SEO a2z
WordPress 5.3
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-2019. All rights reserved.


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

  • Home
  • Blog
  • Sitemap
  • Sites