Make WordPress Core

Ticket #15629: 15629.diff

File 15629.diff, 985 bytes (added by ericmann, 13 years ago)

Adds current_theme_supports() check to set_post_format().

  • wp-includes/post.php

     
    535535                        $format = 'post-format-' . $format;
    536536        }
    537537
    538         return wp_set_post_terms($post->ID, $format, 'post_format');
     538        if ( current_theme_supports( 'post-formats', $format ) )
     539                return wp_set_post_terms($post->ID, $format, 'post_format');
    539540}
    540541
    541542/**
  • wp-includes/theme.php

     
    17731773                        else
    17741774                                return false;
    17751775                        break;
     1776                case 'post-formats':
     1777                        // post-formats can be registered by passing an array of post formats to add_theme_supprt().
     1778                        $post_type = $args[0];
     1779                        if ( in_array($post_type, $_wp_theme_features[$feature][0]) )
     1780                                return true;
     1781                        else
     1782                                return false;
     1783                        break;
    17761784        }
    17771785
    17781786        return true;