WordPress.org

Make WordPress Core

Changeset 15779


Ignore:
Timestamp:
10/12/2010 07:43:54 PM (9 years ago)
Author:
ryan
Message:

Allow deleting a format. see #14746

File:
1 edited

Legend:

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

    r15778 r15779  
    511511 *
    512512 * @param int|object $post The post for which to assign a format
    513  * @param string $format  A format to assign.
     513 * @param string $format  A format to assign.  Use an empty string or array to remove all formats from the post.
    514514 * @return mixed WP_Error on error. Array of affected term IDs on success.
    515515 */
     
    520520        return new WP_Error('invalid_post', __('Invalid post'));
    521521
    522     $format = sanitize_key($format);
    523 
    524     return wp_set_post_terms($post->ID, array('post-format-' . $format), 'post_format');
     522    if ( !empty($format) )
     523        $format = 'post-format-' . sanitize_key($format);
     524
     525    return wp_set_post_terms($post->ID, $format, 'post_format');
    525526}
    526527
Note: See TracChangeset for help on using the changeset viewer.