Tag Info

New answers tagged

1

I'm able to do the following in media modal: var selection = wp.media.frame.state().get('selection'); // get selected collection attachment = wp.media.attachment(id); // get attachment with id attachment.fetch(); selection.add(attachment); // add attachment to selection collection There should be .remove() method ...


0

You can't have two buttons with the same ID (#upload_image_button) as IDs are supposed to be unique. You should give the buttons a class and give the ID equal to that of the name of the associated input. <input type="text" size="36" name="image_1" value="http://" /> <input id="image_1" class="button upload_image_button" type="button" ...


0

I found nothing better than: // switch to attachment browser wp.media.frame.content.mode('browse'); // refresh attachment collection wp.media.frame.content.view.views._views[".media-frame-content"][0].views._views[""][1].collection.props.set({ignore:(+(new Date()))}); Feel free to add proper way of doing this.


0

I would recommend using this plugin: http://wordpress.org/plugins/enhanced-media-library It allows you to fully manage your media files with the ability to add taxonomies (categories and tags). I would avoid renaming or creating new directories manually within the uploads directory on your server. It's important that new upload directories are registered ...


0

i have found the culprit. http-authentication plugin. not sure what it does but it was enabled and ticked as active, so i just unticked it.


0

This is the solution..... hope you will enjoy You can change that setting by making a simple text file and putting it into the wp-admin folder. So to make this file all you have to do is open a simple text program like textedit on Mac or notepad on Windows and type these two lines of code. upload_max_filesize = 64M; post_max_size = 32M; You can put in ...


0

I believe the following is happening here: As @Luke pointed out, wp_insert_attachment() takes an array of post data. The format of the array you are passing to it is not correct. The keys are different. What should be stored as the post_mime_type, is being passed with the key type. Because of this, no mime type is being saved for the post. ...


2

You can work on the idea that Joost provided and use the upload_dir filter to temporarily set the upload path to somewhere else. /** * Override the default upload path. * * @param array $dir * @return array */ function wpse_141088_upload_dir( $dir ) { return array( 'path' => $dir['basedir'] . '/mycustomdir', 'url' ...


1

Seems like core just needs a better way to handle backwards compatibility with Plupload at the WordPress level :) You as a plugin developer shouldn't have to worry about that, your usage looks fair, given that there currently is no other way to obtain that default settings array. I've opened #27763 to address this and some other compatibility issues with ...


0

This one is much easier to add on the functions.php and works like charm : function hide_media_by_other($query) { global $pagenow; if( 'upload.php' != $pagenow || !$query->is_admin ){ return $query; } if( !current_user_can( 'manage_options' ) ) { global $user_ID; $query->set('author', $user_ID ); } return $query; } ...


1

You have a variable scope problem. $post_id = wp_insert_post($post_information); function upload_user_file( $file = array() ) { require_once( ABSPATH . 'wp-admin/includes/admin.php' ); $file_return = wp_handle_upload( $file, array('test_form' => false ) ); // ... You set $post_id outside of your upload_user_file() function but that ...


0

I actually figured it out, I had the user assigned to the wrong role, so upload_files works. FYI the error was verbatum HTTP ERROR. If the error would have been permission denied I would have figured it out sooner.


1

Try removing (function($){ from the beginning and })(jQuery); from the end. And change jQuery(document).ready(function() to jQuery(document).ready(function($)


0

The first line is just an HTML comment outside the scope of PHP. It'll output with every response and creates all the kinds of headaches you're experiencing. Solution? Remove it, or make it a PHP comment: <?php /* In a child theme, all of the functions of the parent theme are present, unless overridden here */ You should also make sure there's ...


1

I am working on something similar. This is for a podcast upload meta-box. Returns the url to the file. Here is what I have so far: /*******************************************************Podcast Meta-boxes *******************/ //Add Metabox add_action( 'add_meta_boxes', 'add_upload_file_metaboxes' ); function add_upload_file_metaboxes() { ...


0

This turned out to be a setting error on my part. In Network Admin > Sites > Settings for blog /, I had not updated the File uploads URL field. One little variable ....


0

I think the best plug in to solve this problem is Media File Manager Advanced. I let you check the description of it at: http://wordpress.org/plugins/media-file-manager-advanced/


0

media_handle_sideload handles the uploads in the same way the normal upload does. That means, when you upload a remote image (YouTube thumbnails in your case) it will automatically create the thumbnails of sizes registered using add_image_size. So, what you need to do is create a thumbnail of desired size and call it in your loop. function my_setup() { ...


3

I have a plugin that does this manually in batch processes via ajax and I've been getting a lot of request for a way to make it automated. This is the function that loads the post, downloads the images into the uploads directory and attaches them to the post. Then it does a search and replace for the old img urls and replaces them with the new ones. Attach ...


0

If you are using WP MultiSite you can configure the behavior the following way (tested in WP 3.8.1): Go to the network settings in your browser: http://example.com/wp-admin/network/settings.php Scroll down to the bottom of the settings page and you will find a list of allowed file types, add zip to it.


1

I just ran into this. The reason is that you are overriding the window.send_to_editor function with one of your own. WordPress uses this function to insert galleries and other stuff, so now that you've changed it, it can't. Ideally' you'd want to use an event triggered by the media uploader instead of just replacing the function, or at least replacing it ...


0

I have this same issue (can upload fine, but not insert into post). It appears that for me I'm changing the location of my wp-content folder by using a combination of these config values: define('WP_CONTENT_FOLDERNAME', 'media'); define('WP_CONTENT_DIR', ABSPATH . WP_CONTENT_FOLDERNAME ); define('WP_CONTENT_URL', 'http://domain.com'.WP_CONTENT_FOLDERNAME); ...


1

Do you have the "all-in-one-wp-security-and-firewall" plugin? More info: https://wordpress.org/support/topic/load-scriptphp-fails-to-load?replies=3 Short answer, if so, disable the "Deny Bad Query Strings" option. If not, check for any other "security" plugins you have that might be doing dumb things.



Top 50 recent answers are included