WordPress. How to use media library for choosing image in extrafields or media box olatechproMarch 30, 20232 Views I have spent 3 hours, so maybe someone needs the solution. So I answered the question on my own. Post Views: 2 Related postsGet rid of this Strict Standards warningWooCommerce: get_current_screen not working with multi languageCan’t login on WordPressForce HTTPS using .htaccess – stuck in redirect loopWordPress: Ajax not working to insert, query and result dataHow Can I pass an image file to wp_handle_upload?
<?php echo media_buttons(); ?> <input id="category_image" type="hidden" size="100" name="category_meta[category_image]" value="" /> <div id="category_image_preview"></div> <script> (function( $ ) { window.send_to_editor = function ( imgHtml ) { $( '#category_image_preview' ).html( imgHtml ) var imgUrl = $( 'img', imgHtml ).attr( 'src' ); $( '#category_image' ).val( imgUrl ); tb_remove(); }; })( jQuery ); </script> Log in to Reply
1 comment