WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/17/2013 08:57:44 PM (8 years ago)
Author:
markjaquith
Message:

Standardize post format postmeta keys around the ones already used by the Crowd Favorite plugin.

props wonderboymusic. fixes #24010.

File:
1 edited

Legend:

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

    r23985 r24021  
    193193
    194194    // Post Formats
    195     if ( isset( $post_data['post_format'] ) ) {
     195    if ( isset( $post_data['post_format'] ) )
    196196        set_post_format( $post_ID, $post_data['post_format'] );
    197     }
    198 
    199     if ( isset( $post_data[ '_wp_format_url' ] ) ) {
    200         update_post_meta( $post_ID, '_wp_format_url', wp_slash( esc_url_raw( wp_unslash( $post_data['_wp_format_url'] ) ) ) );
    201     }
    202 
    203     $format_keys = array( 'quote', 'quote_source', 'image', 'gallery', 'audio', 'video' );
     197
     198    $format_meta_urls = array( 'url', 'link_url', 'quote_source_url' );
     199    foreach ( $format_meta_urls as $format_meta_url ) {
     200        $keyed = '_format_' . $format_meta_url;
     201        if ( isset( $post_data[ $keyed ] ) )
     202            update_post_meta( $post_ID, $keyed, wp_slash( esc_url_raw( wp_unslash( $post_data[ $keyed ] ) ) ) );
     203    }
     204
     205    $format_keys = array( 'quote', 'quote_source_name', 'image', 'gallery', 'audio_embed', 'video_embed' );
    204206
    205207    foreach ( $format_keys as $key ) {
    206         if ( isset( $post_data[ '_wp_format_' . $key ] ) ) {
     208        $keyed = '_format_' . $key;
     209        if ( isset( $post_data[ $keyed ] ) ) {
    207210            if ( current_user_can( 'unfiltered_html' ) )
    208                 update_post_meta( $post_ID, '_wp_format_' . $key, $post_data[ '_wp_format_' . $key ] );
     211                update_post_meta( $post_ID, $keyed, $post_data[ $keyed ] );
    209212            else
    210                 update_post_meta( $post_ID, '_wp_format_' . $key, wp_filter_post_kses( $post_data[ '_wp_format_' . $key ] ) );
     213                update_post_meta( $post_ID, $keyed, wp_filter_post_kses( $post_data[ $keyed ] ) );
    211214        }
    212215    }
Note: See TracChangeset for help on using the changeset viewer.