Using the default wordpress uploader inside plugin

have you search in other question? this is the jquery script to call media uploader if u click a element media button var $j = jQuery.noConflict(); function call_media_library() { var media_uploader; $j(document).on(‘click’, ‘.video_media_btn’, function(e){ e.preventDefault(); var btn_uploader = $j(this); if (media_uploader) { media_uploader.open(); return; } media_uploader = wp.media({ title: ‘Upload media’, //you can change type … Read more

Flatten media files in uploads directory via linux terminal eliminating thumbnails?

Warning: Please make a backup first, as this can do irreversable damage. Go to your uploads directory: cd /path/to/directory cp -r uploads uploads.backup Flatten the files in uploads directory: find * -type f -exec bash -c ‘file=${1#./}; echo mv “$file” “${file//\//_}”‘ _ ‘{}’ \; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2017/12/some-image-150×150.jpg —> 2017_12_some-image-150×150.jpg 2017/12/some-image-360×240.jpg —> 2017_12_some-image-360×240.jpg 2017/12/some-image-720×900.jpg —> 2017_12_some-image-720×900.jpg 2017/12/some-image.jpg … Read more

Uploading dwg files to wordpress

Your code should work just fine. The only problem in there is that you’ve set incorrect mime type, I guess… It should be image/vnd.dwg. So this one should work: function custom_upload_mimes ( $existing_mimes=array() ) { $existing_mimes[‘dwg’] = ‘image/vnd.dwg’; return $existing_mimes; } add_filter(‘upload_mimes’, ‘custom_upload_mimes’);

Convert all images to PNG on file upload

(Updated answer) The sight() function not only uploads the image, but also creates an attachment (i.e. a post of the attachment type); hence, I updated the code — it’s now in a function named attachment_to_png, and that it uses the get_attached_file() to get the image file attached to that attachment, and the update_attached_file() to update … Read more

Cannot upload .mp3 file to wordpress media

you need to allow them to be uploaded in your media files. you can add following code to your themes functions.php function my_mime_types($mime_types){ $mime_types[‘mp3’] = ‘audio/mpeg’; return $mime_types; } add_filter(‘upload_mimes’, ‘my_mime_types’, 1, 1); there is more information about adding new mime types in WP here: https://wpsmackdown.com/add-remove-filetypes-wordpress-media-library/#add-filetypes And here a list of the mime_types: https://feedforall.com/mime-types.htm

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