Make WordPress Core


Ignore:
Timestamp:
12/03/2012 07:17:10 AM (13 years ago)
Author:
ryan
Message:

In the QuickPress media modal, use the new post id when a post is published.

Props nacin, koopersmith
fixes #22673

File:
1 edited

Legend:

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

    r22964 r22994  
    506506
    507507    $post_ID = (int) $post->ID;
     508
     509    $media_settings = array(
     510        'id' => $post->ID,
     511        'nonce' => wp_create_nonce( 'update-post_' . $post->ID ),
     512    );
     513
     514    if ( current_theme_supports( 'post-thumbnails', $post->post_type ) && post_type_supports( $post->post_type, 'thumbnail' ) ) {
     515        $featured_image_id = get_post_meta( $post->ID, '_thumbnail_id', true );
     516        $media_settings['featuredImageId'] = $featured_image_id ? $featured_image_id : -1;
     517    }
    508518?>
    509519
     
    525535        </div>
    526536
    527         <script type="text/javascript">edCanvas = document.getElementById('content');edInsertContent = null;</script>
     537        <script type="text/javascript">
     538        edCanvas = document.getElementById('content');
     539        edInsertContent = null;
     540        <?php if ( $_POST ) : ?>
     541        wp.media.editor.remove('content');
     542        wp.media.view.settings.post = <?php echo json_encode( $media_settings ); // big juicy hack. ?>;
     543        wp.media.editor.add('content');
     544        <?php endif; ?>
     545        </script>
    528546
    529547        <div class="input-text-wrap" id="tags-input-wrap">
Note: See TracChangeset for help on using the changeset viewer.