[wp-trac] [WordPress Trac] #8657: add filter to get_post_status() to allow overriding the status of objects

WordPress Trac wp-trac at lists.automattic.com
Thu Dec 18 01:09:46 GMT 2008


#8657: add filter to get_post_status() to allow overriding the status of objects
-------------------------+--------------------------------------------------
 Reporter:  DD32         |       Owner:  anonymous
     Type:  enhancement  |      Status:  new      
 Priority:  normal       |   Milestone:  2.8      
Component:  General      |     Version:  2.7      
 Severity:  normal       |    Keywords:  hsa-patch
-------------------------+--------------------------------------------------
 At present, For an attachment to be visible on the front end, The
 attachment needs to be either attached to a published post, or the user
 needs to be logged in and be able to edit the attachment.

 Sometimes this'll cause problems with those designing websites focused
 around attachment items (A Unique Photo-orientated site for example,
 focused around Images rather than Posts)

 While there are a lot of issues (in my mind) of separate interlinked
 issues with having attachments published on the front end, They can all be
 worked around, Aside from {{{get_post_status()}}} returning false for
 attachments, This ends up causing a 404 for non-attachment-editors/non-
 logged-in-users; Attaching a filter to this will allow for being able to
 set a attachment as 'publish'ed while not modifying the way the rest of
 the wordpress media management works, Eg:
 {{{
 add_filter('post_status-attachment', 'theme_attachment_publish');
 function theme_attachment_publish($status) {
         return is_admin() ? $status : 'publish';
 }
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/8657>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list