Stop WordPress from reserving slugs for media items?

Thank you for the response everyone. I played around with macemmek’s solution and I think it led me to an even better solution: add_filter( ‘wp_unique_post_slug_is_bad_attachment_slug’, ‘__return_true’ ); That is all that is needed. This will automatically ‘skip’ the default assigned slug on any attachment. So an attachment that might normally get the slug “services” will … Read more

Proper way to add a button to the top menu of the media library?

So, this is the only way I’ve found so far and it’s ugly, however WordPress offers no means of modifying this through filters that I can find in core. I present, the hacky “do-it-through-Javascript” method: add_action( ‘load-upload.php’, function(){ $js = <<<JAVASCRIPT jQuery(document).ready(function($){ setTimeout(function() { $(‘.wp-filter .button:last’ ).after($(‘<button class=”button”>Hi</button>’)); }, 1000); }); JAVASCRIPT; add_filter( ‘admin_footer’, function() … Read more

Display attachments by ID in a wp.media frame

You can always filter on the client side: var query = wp.media.query(); query.filterWithIds = function(ids) { return _(this.models.filter(function(c) { return _.contains(ids, c.id); })); }; var res = query.filterWithIds([6,87]); // change these to your IDs res.each(function(v){ console.log( v.toJSON() ); }); Disclaimer: found the beautiful filterWithIds function in this SO question.

Remote upload file to server B

Try adding die(‘message’); and use that to debug where it fails. Also try and use ftp://external-server.com as opposed to just external-server.com. Also make sure you use your FTP password. And try it on active mode as opposed to passive mode. When I was trying to upload by FTP that’s what I had to do. Also … Read more

WordPress Media Manager 3.5 – default link to

You can do what you want by overriding appropriate Backbone view, which is responsible for rendering attachments display settings form. plugin.php add_action( ‘load-post.php’, ‘wpse8170_media_popup_init’ ); add_action( ‘load-post-new.php’, ‘wpse8170_media_popup_init’ ); function wpse8170_media_popup_init() { wp_enqueue_script( ‘wpse8170-media-manager’, plugins_url( ‘/js/media.js’, __FILE__ ), array( ‘media-editor’ ) ); } media.js (function() { var _AttachmentDisplay = wp.media.view.Settings.AttachmentDisplay; wp.media.view.Settings.AttachmentDisplay = _AttachmentDisplay.extend({ render: function() … Read more

Decrease file size upload in Media

That number is taken from wp_max_upload_size(), and there is a filter: ‘upload_size_limit’. See wp-admin/includes/template.php. So this should work (not tested): add_filter( ‘upload_size_limit’, ‘wpse_70754_change_upload_size’ ); function wpse_70754_change_upload_size() { return 1000 * 1024; }

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