Custom “Uploads” Dir: “Edit Image” in Media Library broken
The uploads dir has its own define in wp-config: define( ‘UPLOADS’, WP_CONTENT_URL.’/customuploads’ );
The uploads dir has its own define in wp-config: define( ‘UPLOADS’, WP_CONTENT_URL.’/customuploads’ );
http://codex.wordpress.org/Javascript_Reference/wp It’s a work in progress. Contribute if you can!
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
@t31os Thanks for your response. I’m sure it is just my browser caching the images. But (I should have specified) I’m not the only user. I’d prefer not to have to tell my users to refresh every time they delete something or the clunkiness of building in a page refresh as part of image deletion. … Read more
i guess you are looking for this add_attachment and delete_attachment example: add_action(‘add_attachment’, ‘attachment_manipulation’); function attachment_manipulation($id) { if(wp_attachment_is_image($id)){ //do your own tasks } }
This should work: add_filter( ‘media_view_strings’, ‘cor_media_view_strings’ ); /** * Removes the media ‘From URL’ string. * * @see wp-includes|media.php */ function cor_media_view_strings( $strings ) { unset( $strings[‘insertFromUrlTitle’] ); return $strings; }
combining the two answer on this page, I found this worked. $args = new WP_Query(array( ‘post_type’ => ‘post’, ‘posts_per_page’ => -1 )); $loop = new WP_Query($args); while($loop->have_posts()) { the_post(); $args2 = array( ‘order’ => ‘ASC’, ‘post_type’ => ‘attachment’, ‘post_parent’ => $post->ID, ‘post_mime_type’ => ‘image’); $attachments = get_posts($args2); if($attachments) { foreach ($attachments as $img_post) { if( … Read more
You can try this (untested) modification to the answer you linked to by @something wp post delete $(wp post list –post_type=”attachment” –format=ids –post_parent=0) to delete attachments without parents. To target a given mime type, e.g. image/jpeg try: wp post delete $(wp post list –post_type=”attachment” \ –format=ids –post_parent=0 –post_mime_type=”image/jpeg”) Notes: Remember to backup first before testing! … Read more
Here are 2 methods: Method 1: Remove the upload_files capability from the respective roles. e.g. removing it from author: $role = get_role( ‘author’ ); $role->remove_cap( ‘upload_files’ ); This is saved to the database so it should only happen once, not on every page load. Removing it from the editor role should be the same albeit … Read more
When I use WordPress Import in this cases, this is what I do: Export the XML in localhost. Open the exported file in a text editor. Search and replace http://localhost/wp-content/uploads/ for http://example.com/custom-temporary-folder/. Upload the uploads folder via FTP to the custom-temporary-folder. Perform the Import in example.com using the modified XML file.