Disable wordpress gif compression?

There are two main concerns with using animated gifs in WordPress: dimensions and file size. When you upload a gif file to the media library, WordPress stores the original file and additional files for different sizes ( medium, thumbnail ). Gifs of other sizes will be stored with one frame of animation only, so they … Read more

Load media from another URL on a multisite install

I found a solution on Stack Overflow. So I added the following to .htaccess Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteRule ^wp-content/uploads/(.*) http://their-domain.com.com/wp-content/uploads/$1 [R=301,NC,L] This replaces all references to the local uploads folder with a remote uploads folder on the fly and I see images on my local dev area without having to download 30GB+ … Read more

Why does my media selection script write to ONLY the first input field?

this problem is because of the first “if”, the good text field in only set the first time to change that, you can add a “data” arguement in HTML and change the JavaScript code like that (look the modification in meta_image_frame.on(‘select’…) (function($) { ‘use strict’; $(function() { var meta_image_frame; function saveImage(e, uiElement) { e.preventDefault(); if … Read more

media_sideload_image results in http error (500)

The media_sideload_image() function is only available in the admin by default, and init runs on all page loads. See the Codex article: If you want to use this function outside of the context of /wp-admin/ (typically if you are writing a more advanced custom importer script) you need to include media.php and depending includes: require_once(ABSPATH … Read more

Change behavior of the “ADD Media” buttom

Js file (function() { tinymce.PluginManager.add( ‘custom_class’, function( editor, url ) { // Add Button to Visual Editor Toolbar editor.addButton(‘custom_class’, { title: ‘Insert PDF Tag’, cmd: ‘custom_class’, image: url + ‘/icon.png’, }); // Add Command when Button Clicked editor.addCommand(‘custom_class’, function() { var text = editor.selection.getNode(); if ( text.length === 0 ) { alert( ‘Please select some … Read more

Use wget to find used images

Your asking for command line solution, I don’t have one – but for PHP you can cycle through all posts, build an array of files, compare it to an array of the media library, find unused and delete. Cycle through Posts use get_posts() for pages andor posts, and build your foreach loop Extract Media From … Read more