How to create different media uploader frames / filter library depending on a custom action

You will have to create two different media modals that are fired depending on your click event. Here is some code from a recent project where I added these buttons to the tinyMCE visual editor: jQuery(document).ready(function($){ $(document).on(‘click’, ‘.mce-my_upload_button’, upload_image_tinymce); $(document).on(‘click’, ‘.mce-my_upload_pdf_button’, upload_pdf_tinymce); function upload_image_tinymce(e) { e.preventDefault(); var $input_field = $(‘.mce-my_input_image’); var custom_uploader = wp.media.frames.file_frame = … Read more

Modify media file markup output

WordPress has a filter image_send_to_editor which lets you modify the html that is generated by the media editor. Usage: add_filter (‘image_send_to_editor’, ‘wpse264886_filter_image’, 10, 8); function wpse264886_filter_image ($html, $id, $caption, $title, $align, $url, $size, $alt) { $html=”<span> … </span>” . $html; return $html; } This will insert the spans always, however, not only when there is … Read more

WP_Custom_Media_Control | Give ID to media file

The setting associated with the media control will have the ID for the attachment stored as its value. Assuming you have registered a setting for your control like this: $wp_customize->add_setting( ‘resume’, array( ‘type’ => ‘option’, // … ) ); Then you would obtain the attachment ID just by reading from the option, like: get_option( ‘resume’ … Read more

Connection dropped due to file size

It sounds like you are attempting to push too much data at one time. GoDaddy may be terminating the connection because of a size limit per request or the upload is taking longer than they allow (because it is so large.) In either case it is a sign the amount of data is too large. … Read more

Admin hook after editing an image?

Unless I’ve missed something in the flow of this, It seems the mentioned WPSE answer is correct. The filter hook referenced, wp_save_image_editor_file, is applied in the wp_save_image_file() function when dealing with an instance of WP_Image_Editor class; giving access to $filename (trac link for below): * @param mixed $override Value to return instead of saving. Default … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)