WordPress at Your Fingertips
function is not described

_draft_or_post_title() WP 2.7.0

Get the post title.

The post title is fetched and if it is blank then a default string is returned.

This is an internal function for using it by WP core itself. It's not recommended to use this function in your code.

No Hooks.


String. The post title if set.


_draft_or_post_title( $post );
Post ID or WP_Post object.
Default: global $post


Since 2.7.0 Introduced.

Code of _draft_or_post_title() WP 5.8.2

function _draft_or_post_title( $post = 0 ) {
	$title = get_the_title( $post );
	if ( empty( $title ) ) {
		$title = __( '(no title)' );
	return esc_html( $title );