Tag Info

New answers tagged

0

I made some changes in functions.php: function remove_media_tab( $strings ) { if( !current_user_can( 'administrator' ) ) { $strings["createGalleryTitle"] = ""; $strings["setFeaturedImageTitle"] = ""; $strings["insertFromUrlTitle"] = ""; } return $strings; } add_filter( 'media_view_strings', 'remove_media_tab' ); It ...


0

By enququing an JS file we can do like this: <img src="#" id="img-src"> <a href="#" id="img-upload">Add Image</a> Content of JS file jQuery(document).ready(function(e){ e.preventDefault(); jQeury('#img-upload').click(function(){ var upload = wp.media({ title:'Choose Image', //Title for Media Box ...


2

Just for clarity: borrowing from this answer, add the following to your theme's functions.php: function wpse_188427_delete_post_media( $post_id ) { $attachments = get_posts( array( 'post_type' => 'attachment', 'posts_per_page' => -1, 'post_status' => 'any', 'post_parent' => ...


0

There is no default way to do this, but this popular plugin solves the issue for most people. I have no connection to the creators of this free plugin, but I've used it on several sites. https://wordpress.org/plugins/enable-media-replace/


0

Got the solution...! Use fn.state('embed' insted of fn.on( 'insert' Or use Both of them fn.state('embed' & fn.on( 'insert' fn.state('embed').on( 'select', function() { var state = fn.state(), type = state.get('type'), embed = state.props.toJSON(); // SHOW JSON for embeded URL console.log('embed'+JSON.stringify(embed)); ...


0

The correct way of refreshing the content of the frame, as found in the WP core, is as below: if(wp.media.frame.content.get()!==null){ wp.media.frame.content.get().collection.props.set({ignore: (+ new Date())}); wp.media.frame.content.get().options.selection.reset(); }else{ wp.media.frame.library.props.set({ignore: (+ new Date())}); } You should ...



Top 50 recent answers are included