Image problem – Multisite image upload broken

Just change your .htaccess to this: # BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] # uploaded files RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L] # add a trailing slash to /wp-admin RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ – [L] RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L] RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L] RewriteRule … Read more

Is it possible to hide media details sidebar when wp.media popup is being opened?

Ok, It’s been so long since I posted this question I totally forgot about it. I finally used popup.on( ‘open’, function() {…}); to remove left modal sidebar. Here we go: popup.on( ‘open’, function() { jQuery( ‘.media-frame-menu’ ).remove(); jQuery( ‘.media-frame-router, .media-frame-title, .media-frame-content, .media-frame-toolbar’ ).css({‘left’: 0}); }); That’s it 🙂 EDIT I managed to hide right hand … Read more

Custom delete option button in plugin settings

I managed to add delete button this way, it also may be used to add any extra submit button. Create a submit button with name and array attribute: function mw_options_wc_order_attachement_1() { ?> <input type=”file” name=”mw_options_wc_order_attachement_1″ id=”mw_options_wc_order_attachement_1″ value=”<?php echo get_option(‘mw_options_wc_order_attachement_1’); ?>” /> <?php echo get_option(“mw_options_wc_order_attachement_1″); ?> <input type=”submit” name=”submit[delete_attachment_1]” class=”button button-primary” value=”Delete” /> <?php } Register … Read more

How can I store a file in the database in the same way WordPress and ACF do?

ACF doesn’t store any file in Database, it simply provides meta fields with user friendly interface. You can however, store them yourself. To store a field, you need to be familiar with PHP a bit. Here’s how saving a meta field happens, by using the add_post_meta() function: add_post_meta ( $post_id, ‘meta_key’, ‘meta_value’, $is_unique ); There … Read more

Why is $_REQUEST an empty array in admin-ajax.php?

Here’s the problem: var formData = new FormData(); formData.append( “userfile”, $(this)[0].files[0] ); formData.append( “action”, “vibesoft_files_upload” ); formData.append( “_wpnonce”, vbsoft.nonce_upload ); console.log( formData ); $.ajax({ type: “post”, url: vbsoft.ajax_url, data: formData, Specifically: var formData = new FormData(); Nowhere in the jQuery documentation does it say that data accepts a FormData object for the data parameter: data … Read more

Copying uploaded images not working in wordpress

Since i was also looking for some sort of keeping submitted images, i found this simple plugin, which gave me a bit insight: https://wordpress.org/plugins/store-file-uploads-for-contact-form-7/ Also if you read a bit on the mentioned “file-uploading-and-attachment” topic in cf7, you should get the point: For security reasons, specifying files outside of the wp-content directory for email attachments … Read more

WordPress upload_mimes not working for front-end uploads of 3D files

Thanks to this thread here, I found this code function fix_wp_csv_mime_bug( $data, $file, $filename, $mimes ) { $wp_filetype = wp_check_filetype( $filename, $mimes ); $ext = $wp_filetype[‘ext’]; $type = $wp_filetype[‘type’]; $proper_filename = $data[‘proper_filename’]; return compact( ‘ext’, ‘type’, ‘proper_filename’ ); } add_filter( ‘wp_check_filetype_and_ext’, ‘fix_wp_csv_mime_bug’, 10, 4 ); which does allow the files to be uploaded through the … Read more

Can I hide certain upload folders in media library [duplicate]

Perhaps a bit quick and dirty, but this should work: function media_library_hide_dlm_downloads($where) { if(isset($_POST[‘action’]) && ( $_POST[‘action’] == ‘query-attachments’)) { $where .= ‘ AND guid NOT LIKE “%wp-content/uploads/dlm_downloads%”‘; } return $where; } add_filter(‘posts_where’, ‘media_library_hide_dlm_downloads’); Read more about the posts_where filter.