Ticket #39625: 39625.diff
File 39625.diff, 2.8 KB (added by , 6 years ago) |
---|
-
wp-admin/includes/ajax-actions.php
2416 2416 wp_die(); 2417 2417 } 2418 2418 2419 echo wp_json_encode( 2420 array( 2421 'success' => true, 2422 'data' => $attachment, 2423 ) 2424 ); 2419 /** 2420 * Ajax handler check set as featured image or not 2421 * if set as featured image and set as doc. file then it's return error. 2422 * 2423 * @since 5.3.0 2424 */ 2425 $success = true; 2425 2426 2427 if(isset($_REQUEST['action']) && $_REQUEST['action'] == 'upload-attachment' && isset($_REQUEST['is_featured']) && $_REQUEST['is_featured'] == 'true' && isset($attachment['type']) && $attachment['type'] != 'image'){ 2428 2429 $success = false; 2430 $attachment = array( 2431 'message' => __( 'The uploaded file is not a valid image. Please select valid file format.' ), 2432 'filename' => $_FILES['async-upload']['name'], 2433 ); 2434 2435 } 2436 2437 echo wp_json_encode( 2438 array( 2439 'success' => $success, 2440 'data' => $attachment, 2441 ) 2442 ); 2443 2426 2444 wp_die(); 2427 2445 } 2428 2446 -
wp-includes/js/media-editor.js
693 693 694 694 wp.media.featuredImage.set( selection ? selection.id : -1 ); 695 695 }, 696 696 697 /** 697 698 * Open the content media manager to the 'featured image' tab when 698 699 * the post thumbnail is clicked. … … 700 701 * Update the featured image id when the 'remove' link is clicked. 701 702 */ 702 703 init: function() { 703 $('#postimagediv').on( 'click', '#set-post-thumbnail', function( event ) { 704 705 $(document).on('click', '.editor-post-featured-image__toggle', function(){ 706 _wpPluploadSettings.defaults.multipart_params['is_featured'] = true; 707 }); 708 709 $(document).on('click', '.editor-media-placeholder__button', function(){ 710 _wpPluploadSettings.defaults.multipart_params['is_featured'] = false; 711 }); 712 713 $('#postimagediv').on( 'click', '#set-post-thumbnail, .editor-post-featured-image__toggle', function( event ) { 714 _wpPluploadSettings.defaults.multipart_params['is_featured'] = true; 704 715 event.preventDefault(); 705 716 // Stop propagation to prevent thickbox from activating. 706 717 event.stopPropagation(); … … 778 789 * @returns {wp.media.view.MediaFrame.Select} A media workflow. 779 790 */ 780 791 add: function( id, options ) { 792 793 /** 794 * Check upload media is not a featured image 795 * 796 **/ 797 798 _wpPluploadSettings.defaults.multipart_params['is_featured'] = false; 799 781 800 var workflow = this.get( id ); 782 801 783 802 // only add once: if exists return existing