Pre populate WordPress wp_media modal with image selection

Here is the script: I’m using the function loadImages in following script to load the existing attached images via AJAX and then just pass the function with the IDs of images and it opens up a pre-populated modal. var frame, selection = loadImages(images); $(‘#stag_images_upload’).on(‘click’, function(e) { e.preventDefault(); var options = { title: ‘<?php _e(“Create Featured … Read more

How to Protect Uploads, if User is not Logged In?

Only checking if the cookie exists, is not much of a strict protection. To get a stronger protection, you can pass or “proxy” all requests to the uploaded folder (exemplary uploads in the following example) through a php script: RewriteCond %{REQUEST_FILENAME} -s RewriteRule ^wp-content/uploads/(.*)$ dl-file.php?file=$1 [QSA,L] All requests to uploaded files (which includes images in … Read more