Upload media file problem

I’d suggest asking your client what value is shown when adding media, as shown here in the screenshot. If the value shown is 1mb then i can tell you the function responsible is the following. function wp_max_upload_size() { $u_bytes = wp_convert_hr_to_bytes( ini_get( ‘upload_max_filesize’ ) ); $p_bytes = wp_convert_hr_to_bytes( ini_get( ‘post_max_size’ ) ); $bytes = apply_filters( … Read more

Select image sizes you want to be uploaded

If I am not mistaken, WordPress just creates these sizes. The only thing you can say is which image you want to pick of these sizes. You can use this piece of code to make the sizes appear inside of the dropdown. Make sure to place this inside the functions.php after adding the image_sizes. function … Read more

WordPress Media mime type filter problem 4.0

Here’s a workaround you can put in a plugin or your theme’s functions.php file. So far no problems. /* * Workaround Bug 30123 * Affects WP 4.0+, should be fixed in WP 4.1 * https://core.trac.wordpress.org/ticket/30123 */ function bugfix30123__action__admin_init() { if ( isset( $_GET[‘attachment-filter’] ) && is_string( $_GET[‘attachment-filter’] ) ) { $_GET[‘attachment-filter’] = $_REQUEST[‘attachment-filter’] = str_replace( … Read more

Add media with WP-Rest-API v2 II

I suspect based on an answer at StackOverflow that something like this would work: base64credentials=”…… ” curl –request POST \ –url “http://www.yoursite.com/wp-json/wp/v2/media” \ –header “cache-control: no-cache” \ –header “content-disposition: attachment; filename=tmp” \ –header “authorization: Basic $base64credentials” \ –header “content-type: image/png” \ –data-binary “@/home/web/tmp.png” \ –location This should use tmp.png to create and upload a brand … Read more

Upload images and attachments from frontend form

I mentioned in a comment how it’s important to debug your code. Here’s why: The images are added first. In the image adding section, you’re running this line of code: $_FILES = array(“moreimages” => $image); Then when you get to your routine that adds the files, you start with this: $files = $_FILES[‘morefiles’]; Can you … Read more

Add visual editor to Media Edit Screen

This function added to functions.php does exactly that: // Enables Editor in Media edit screen. function add_editor_support_for_attachments($settings) { if( get_post_type() == ‘attachment’){ $quicktags_settings = array( ‘buttons’ => ‘strong,em,link,block,del,ins,ul,ol,li,code,close’ ); $settings = array( ‘wpautop’ => true, ‘textarea_name’ => ‘content’, ‘textarea_rows’ => 10, ‘media_buttons’ => false, ‘tinymce’ => true, ‘quicktags’ => $quicktags_settings, ); return $settings; } } … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)