Tag Info

New answers tagged

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.


0

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.


1

Here is simple function to create your own sub directory for every upload. function kv_custom_image_dir( $pathdata ) { $subdir = '/uploads_img'.$pathdata['subdir']; $pathdata['path'] = str_replace($pathdata['subdir'], $subdir, $pathdata['path']); $pathdata['url'] = str_replace($pathdata['subdir'], $subdir, $pathdata['url']); ...


1

Using var_dump here is not a good idea because you will write the output to the buffer and break the form submission. Use error_log wordpress functions with print_r or var_dump with the following code instead : ob_start(); // start buffer capture var_dump($wpcf7_data); // dump the values $contents = ob_get_contents(); // put ...


1

There is media_handle_sideload() function in core meant for processing files not uploaded through media interface. It's not exactly what you need since it assumes file is outside of uploads and needs to be moved there as part of process, but it should give you and idea on generating and inserting it as valid attachment.


1

... what are the records that I should create in the DB in order for the MediaManager to recognize those new uploads? Honestly, I don't know what the minimum required data is but... WordPress stored the primary data in the $wpdb->posts table as an attachment post type. And significant meta data is stored in the $wpdb->postmeta table under at ...


2

if you need to change default media upload location,you need to edit the wp-config.php file located in the root directory of your WordPress installation. If you want upload directory to be wp-content/files then you will need to place the following code in wp-config.php define( 'UPLOADS', 'wp-content/'.'files' ); If you want the upload directory to be ...


1

You could add an ID as post_parent to the attachment of the header image via wp_update_post() (even though this seems to be a very very hacky way to do it!) The tricky part is to get the ID out of the attachment URL; fortunately Rarst solved this issue long time ago, so you can manually add get_attachment_id() to your functions. Next you'll have to assign ...


1

By default, yes, you will have conflicts. The default WordPress .htaccess rules look something like this: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress The ...



Top 50 recent answers are included