[wp-trac] [WordPress Trac] #30172: Request: Filter for get_post_format

WordPress Trac noreply at wordpress.org
Wed Oct 29 15:43:34 UTC 2014


#30172: Request: Filter for get_post_format
--------------------------+-----------------------------
 Reporter:  landwire      |      Owner:
     Type:  enhancement   |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Post Formats  |    Version:  4.0
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Would it make sense to create a filter in get_post_format()? Then instead
 of having to write this a few times (in each template)

 {{{
 $format = get_post_format();
 if ( false === $format ) {
         $format = 'standard';
 }
 }}}

 there could be just one filter in the functions file that does return
 'standard' when false is returned:

 {{{
 // Apply filter
 add_filter('post_format', 'my_filter');

 function my_filter($format) {
         if ( false === $format ) {
                $format = 'standard';
         }
         return $format;
 }
 }}}

 Or something along those lines.....
 Just an idea,
 Sascha

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


More information about the wp-trac mailing list