[wp-trac] [WordPress Trac] #21941: Remove get_post_format_slugs()

WordPress Trac wp-trac at lists.automattic.com
Thu Sep 20 14:40:52 UTC 2012


#21941: Remove get_post_format_slugs()
-----------------------------+-------------------------
 Reporter:  F J Kaiser       |       Type:  enhancement
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  General
  Version:                   |   Severity:  normal
 Keywords:  2nd-opinion      |
-----------------------------+-------------------------
 I just encountered the `get_post_format_slugs()` function, which is
 basically just wrapping `get_post_format_strings()` and setting the
 strings as keys too. So its output is an assoc array where the keys equal
 the values.

 The three times core calls it, it does it the following:


 {{{
 // ~/wp-includes/posts.php -> set_post_format()
 if ( 'standard' == $format || !in_array( $format, array_keys(
 get_post_format_slugs() ) ) )

 // ~/wp-includes/posts.php -> _post_format_request()
 $slugs = get_post_format_slugs();
 if ( isset( $slugs[ $qvs['post_format'] ] ) )
         $qvs['post_format'] = 'post-format-' . $slugs[ $qvs['post_format']
 ];

 // ~/wp-includes/theme.php -> add_theme_support()
 switch ( $feature ) {
         case 'post-formats' :
                 if ( is_array( $args[0] ) )
                         $args[0] = array_intersect( $args[0], array_keys(
 get_post_format_slugs() ) );
                 break;
 }}}


 So in every case it would've been enough to simply call
 `get_post_format_strings()`.

 Do we really need this function?

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


More information about the wp-trac mailing list