diff --git a/wp-admin/edit-attachment-rows.php b/wp-admin/edit-attachment-rows.php
index 93ebd3bba8..e952bc920e 100644
--- a/wp-admin/edit-attachment-rows.php
+++ b/wp-admin/edit-attachment-rows.php
@@ -30,9 +30,7 @@ while (have_posts()) : the_post();
$class = 'alternate' == $class ? '' : 'alternate';
global $current_user;
$post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
-$att_title = get_the_title();
-if ( empty($att_title) )
- $att_title = __('(no title)');
+$att_title = _draft_or_post_title();
?>
post_status ); ?>' valign="top">
@@ -140,12 +138,9 @@ foreach ($posts_columns as $column_name => $column_display_name ) {
break;
case 'parent':
- $title = __('(no title)'); // override below
if ( $post->post_parent > 0 ) {
if ( get_post($post->post_parent) ) {
- $parent_title = get_the_title($post->post_parent);
- if ( !empty($parent_title) )
- $title = $parent_title;
+ $title =_draft_or_post_title($post->post_parent);
}
?>
>, |
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index f04f1e580d..a6b4335170 100644
--- a/wp-admin/includes/template.php
+++ b/wp-admin/includes/template.php
@@ -893,9 +893,7 @@ function get_inline_data($post) {
if ( ! current_user_can('edit_' . $post->post_type, $post->ID) )
return;
- $title = apply_filters( 'the_title', $post->post_title );
- if ( empty($title) )
- $title = __('(no title)');
+ $title = _draft_or_post_title($post->ID);
echo '
@@ -965,9 +963,7 @@ function _post_row($a_post, $pending_comments, $mode) {
global $current_user;
$post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
$edit_link = get_edit_post_link( $post->ID );
- $title = get_the_title();
- if ( empty($title) )
- $title = __('(no title)');
+ $title = _draft_or_post_title();
?>
post_status ); ?> iedit' valign="top">
\n";
}
-
+/**
+ * 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 $id The post id. If not supplied the global $post is used..
+ *
+ */
+function _draft_or_post_title($post_id = 0)
+{
+ $title = get_the_title($post_id);
+ if ( empty($title) )
+ $title = __('(no title)');
+ return $title;
+}
?>
diff --git a/wp-admin/upload.php b/wp-admin/upload.php
index 07019c9ee9..e6e94dbd7e 100644
--- a/wp-admin/upload.php
+++ b/wp-admin/upload.php
@@ -320,7 +320,7 @@ if ( $page_links )
if ( $orphans ) {
foreach ( $orphans as $post ) {
$class = 'alternate' == $class ? '' : 'alternate';
- $att_title = empty($post->post_title) ? __('(no title)') : wp_specialchars( apply_filters('the_title', $post->post_title) );
+ $att_title = wp_specialchars( _draft_or_post_title($post->ID) );
?>
|