Make WordPress Core

Changeset 16319


Ignore:
Timestamp:
11/12/2010 09:49:34 AM (14 years ago)
Author:
nacin
Message:

Use term cache in get_post_format() to save a boatload of queries. see #15396.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r16313 r16319  
    484484    $post = get_post($post);
    485485
    486     $format = wp_get_object_terms( $post->ID, 'post_format', array('orderby' => 'none', 'fields' => 'names') );
    487 
    488     if ( is_wp_error($format) )
    489         return $format;
    490 
    491     if ( empty($format) )
     486    $_format = get_the_terms( $post->ID, 'post_format' );
     487
     488    if ( empty( $_format ) )
    492489        return false;
    493490
    494     return ( str_replace('post-format-', '', $format[0]) );
     491    $format = array_shift( $_format );
     492
     493    return ( str_replace('post-format-', '', $format->name ) );
    495494}
    496495
Note: See TracChangeset for help on using the changeset viewer.