Remove attachment fields from custom media uploader

I know this isn’t an in depth answer (I’m at work and can’t really test any code) but, maybe you need to look at directly creating hooks for your upload – which should mean that the flash uploader will act as you expect. The hook for the flash loader is: pre-flash-upload-ui You can see where … Read more

media_sideload_image with rewritten urls?

You’re right, it’s because by default, wp_handle_sideload() requires a valid extension in the URI in order to continue processing the sideload. That is, unless your role has a capability called ‘unfiltered_upload‘, which by default is only given to admins. If it seems appropriate (and safe) for you to grant this capability to the user role … Read more

Switched hosts to one with cPanel. To transfer my blog should I do the WP install or just be uploading my old WP directory & database?

You can try the manual transfer, first copy all your tables on your new database. Then you need to update the wp-config.php file in order for it to be able to connect. In case you have the rewriting enabled, you may also need to update the htaccess file (if the rewritebase is different, it’s not … Read more

Limit upload file type on one custom post type

I’m pretty sure $_REQUEST[‘post_id’] will hold the post ID you’re attaching uploads to. So something like this perhaps: if ( isset( $_REQUEST[‘post_id’] ) && $post_id = absint( $_REQUEST[‘post_id’] ) ) { switch ( get_post_type( $post_id ) ) { case ‘document’ : if ( ! in_array( $type, array( ‘pdf’, ‘msword’, ‘vnd.ms-excel’ ) ) ) $file[‘error’] = … Read more

Is it possible to upload text files (e.g. JSON) to wordpress blog in any way? [closed]

function upload_file($file_url) { if ( ! filter_var($file_url, FILTER_VALIDATE_URL) ) return false; $get = wp_remote_get( $file_url ); if ( ! is_wp_error( $get ) ) { // check mime type if you want // $mime_type = wp_remote_retrieve_header( $get, ‘content-type’ ); return wp_upload_bits( basename($file_url), ”, wp_remote_retrieve_body( $get ) ); } return false; } // use it like upload_file(‘http://www.site.com/path/myfile.json’); … Read more

WordPress uploads folder path. how it is decided?

When you uploaded an image within the Edit Page screen for a page with a date of 06/01/2013, the media uploader will use the date of the page to set the sub-directory within the uploads folder. This is expected behavior because the media uploader passes the post_date to the wp_upload_dir() function. See http://codex.wordpress.org/Function_Reference/wp_upload_dir#Important_Note If you … Read more