_draft_or_post_title

The timeline below displays how wordpress function _draft_or_post_title has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Gets the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 *
 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
 * @return string The post title if set.
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return esc_html($title);
}

WordPress Version: .10

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 *
 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
 * @return string The post title if set.
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return esc_html($title);
}

WordPress Version: 4.1

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 *
 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
 * @return string The post title if set.
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return $title;
}

WordPress Version: .10

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 *
 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
 * @return string The post title if set.
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return esc_html($title);
}

WordPress Version: 4.0

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 *
 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
 * @return string The post title if set.
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return $title;
}

WordPress Version: 9.4

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 * @param mixed $post Post id or object. If not supplied the global $post is used.
 * @return string The post title if set
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return esc_html($title);
}

WordPress Version: 9.2

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 * @param mixed $post Post id or object. If not supplied the global $post is used.
 * @return string The post title if set
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return $title;
}

WordPress Version: .10

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 * @param mixed $post Post id or object. If not supplied the global $post is used.
 * @return string The post title if set
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return esc_html($title);
}

WordPress Version: 3.9

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 * @param mixed $post Post id or object. If not supplied the global $post is used.
 * @return string The post title if set
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return $title;
}

WordPress Version: 8.6

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 * @param mixed $post Post id or object. If not supplied the global $post is used.
 * @return string The post title if set
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return esc_html($title);
}

WordPress Version: 8.4

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 * @param mixed $post Post id or object. If not supplied the global $post is used.
 * @return string The post title if set
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return $title;
}

WordPress Version: .30

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 * @param mixed $post Post id or object. If not supplied the global $post is used.
 * @return string The post title if set
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return esc_html($title);
}

WordPress Version: 8.3

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 * @param mixed $post Post id or object. If not supplied the global $post is used.
 * @return string The post title if set
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return $title;
}

WordPress Version: .20

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 * @param mixed $post Post id or object. If not supplied the global $post is used.
 * @return string The post title if set
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return esc_html($title);
}

WordPress Version: 8.2

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 * @param mixed $post Post id or object. If not supplied the global $post is used.
 * @return string The post title if set
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return $title;
}

WordPress Version: .10

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 * @param mixed $post Post id or object. If not supplied the global $post is used.
 * @return string The post title if set
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return esc_html($title);
}

WordPress Version: 3.8

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 * @param mixed $post Post id or object. If not supplied the global $post is used.
 * @return string The post title if set
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return $title;
}

WordPress Version: 7.6

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 * @param mixed $post Post id or object. If not supplied the global $post is used.
 * @return string The post title if set
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return esc_html($title);
}

WordPress Version: 7.5

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 * @param mixed $post Post id or object. If not supplied the global $post is used.
 * @return string The post title if set
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return $title;
}

WordPress Version: .40

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 * @param mixed $post Post id or object. If not supplied the global $post is used.
 * @return string The post title if set
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return esc_html($title);
}

WordPress Version: 7.4

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 * @param mixed $post Post id or object. If not supplied the global $post is used.
 * @return string The post title if set
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return $title;
}

WordPress Version: .30

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 * @param mixed $post Post id or object. If not supplied the global $post is used.
 * @return string The post title if set
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return esc_html($title);
}

WordPress Version: 7.3

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 * @param mixed $post Post id or object. If not supplied the global $post is used.
 * @return string The post title if set
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return $title;
}

WordPress Version: .20

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 * @param mixed $post Post id or object. If not supplied the global $post is used.
 * @return string The post title if set
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return esc_html($title);
}

WordPress Version: 7.2

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 * @param mixed $post Post id or object. If not supplied the global $post is used.
 * @return string The post title if set
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return $title;
}

WordPress Version: .10

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 * @param mixed $post Post id or object. If not supplied the global $post is used.
 * @return string The post title if set
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return esc_html($title);
}

WordPress Version: 3.7

/**
 * Get the post title.
 *
 * The post title is fetched and if it is blank then a default string is
 * returned.
 *
 * @since 2.7.0
 * @param mixed $post Post id or object. If not supplied the global $post is used.
 * @return string The post title if set
 */
function _draft_or_post_title($post = 0)
{
    $title = get_the_title($post);
    if (empty($title)) {
        $title = __('(no title)');
    }
    return $title;
}