wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



get_comment_date › WordPress Function

Seit1.5.0
Veraltetn/v
get_comment_date ( $format = '', $comment_id = 0 )
Parameter: (2)
  • (string) $format Optional. PHP date format. Defaults to the 'date_format' option.
    Erforderlich: Nein
    Standard: (leer)
  • (int|WP_Comment) $comment_id Optional. WP_Comment or ID of the comment for which to get the date. Default current comment.
    Erforderlich: Nein
    Standard:
Gibt zurück:
  • (string) The comment's date.
Definiert in:
Codex:
Changelog:
  • 4.4.0

Retrieves the comment date of the current comment.



Quellcode

function get_comment_date( $format = '', $comment_id = 0 ) {
	$comment = get_comment( $comment_id );

	$_format = ! empty( $format ) ? $format : get_option( 'date_format' );

	$comment_date = mysql2date( $_format, $comment->comment_date );

	/**
	 * Filters the returned comment date.
	 *
	 * @since 1.5.0
	 *
	 * @param string|int $comment_date Formatted date string or Unix timestamp.
	 * @param string     $format       PHP date format.
	 * @param WP_Comment $comment      The comment object.
	 */
	return apply_filters( 'get_comment_date', $comment_date, $format, $comment );
}