New answers tagged

0

What you are asking is default behaviour for the author role. So you don't have to do anything. When an author is in the process of inserting somebody else's media in his post, it looks like he can edit the properties, but this is only true for that current post. If he changes, for instance, the alt attribute, he will get a different alt attribute only for ...


0

Okay so I figured out what was happening - either the new theme or an unintentional wordpress update, lead to media links being handled differently. My new theme now only needs the URL - no shortcodes or iframes - and it seems to automatically process it to display how it used to display them. Only issue with this is that the old posts have to be edited to ...


0

This is not possible via the API; you need to fetch the image yourself, and send the data to the API yourself. This quotes Ryan on the issue mentioned in @Dan answer. Sideloading an image is actually quite easy: $media = media_sideload_image( 'http://i.imgur.com/bcJvAj0.jpg', $post->ID, 'Some image description', 'src' ); if ( ! ...


0

As a comment in this issue, you must add image data after having successfully uploaded the new media file. So, after you have uploaded the photo, you can do a second CURL command to update its data: $host = $host . '/' . json_decode($return)->id; // Retrieve post id from response. $process = curl_init($host); curl_setopt($process, CURLOPT_HTTPAUTH, ...


-1

1: Theme Functions File There are cases where we have seen that just by adding the following code in the theme function’s file, you can increase the upload size: @ini_set( 'upload_max_size' , '64M' ); @ini_set( 'post_max_size', '64M'); @ini_set( 'max_execution_time', '300' ); 2. Create or Edit an existing PHP.INI file In most cases if you are on a ...


2

You can hook into upload_size_limit and set a maximum filesize: // Change the upload size to 1MB add_filter( 'upload_size_limit', 'wpse_228300_change_upload_size' ); function wpse_228300_change_upload_size() { return 1000 * 1024; }


3

Yes, you can use the wp_handle_upload_prefilter that allows you to stop the uploading process if a specific condition is not accomplished. In your case, you could try this code snippet: function limit_upload_size( $file ) { // Set the desired file size limit $file_size_limit = 1024; // 1MB in KB // exclude admins if ( ! current_user_can( '...


0

You don't give enough details but your image naming is just bad for wordpress. I am not sure if anywhere in core there is code that tries to detect a resolution by the filename suffix but it is a fragile and confusing habit. If you have to have the data in the name maybe use underscore instead.


0

The theme was auto generating alternative image sizes for responsiveness, so my newly named images were actually duplicates. Leaving this up in case anyone makes same mistake and stumbles across this.



Top 50 recent answers are included