[wp-trac] [WordPress Trac] #37330: Attachment pages do not always provide a link to the original article.

WordPress Trac noreply at wordpress.org
Mon Jul 11 21:56:28 UTC 2016


#37330: Attachment pages do not always provide a link to the original article.
----------------------------+-----------------------------
 Reporter:  webtechmailbag  |      Owner:
     Type:  enhancement     |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Media           |    Version:  4.5.3
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 I wasn't sure where to post this issue, as it seems to be a limitation in
 the WordPress code itself rather than a bug. But perhaps someone knows
 what's going on?

 Individual attachment pages (which are created when inserting an image or
 gallery on a page or post) sometimes provide a link to the main article,
 BUT NOT ALWAYS.

 This is noticeable in themes which take advantage of this capability, such
 as Twenty Thirteen and Twenty Fourteen, (for other themes that don't
 include a link back to the original article anyway this doesn't matter.)

 For example, in Twenty Thirteen's image.php the following code checks to
 see if the article URL is available. If it is, the attachment page
 displays a "published in" link, but if not it just displays the date:


 {{{
 <div class="entry-meta">
 <?php
 $published_text = __( '<span class="attachment-meta">Published on <time
 class="entry-date" datetime="%1$s">%2$s</time> in <a href="%3$s"
 title="Return to %4$s" rel="gallery">%5$s</a></span>', 'twentythirteen' );

 if ( empty( $post_title ) || 0 == $post->post_parent )
 $published_text = '<span class="attachment-meta"><time class="entry-date"
 datetime="%1$s">%2$s</time></span>';
 }}}


 Obviously, WordPress expects that the article URL will not always be
 known, and this is observable. Some attachment pages link back to the
 article and some do not.

 But why is this? It seems kind of random- I can't figure out which
 scenarios generate an attachment page without the link?

 And in any case, why should WordPress not be able to figure out the
 article URL and always make it available for themes to use?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37330>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list