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 mobi and epub file in the MEDIA of WP

Sounds like you need something like: add_filter(‘upload_mimes’, function ( $mimes = array() ) { $mimes[‘mobi’] = ‘application/x-mobipocket-ebook’; $mimes[‘epub’] = ‘application/epub+zip’; return $mimes; } ); to support the uploads, but you might have to adjust the mime types to your needs.

Uploading non-media files?

There are two ways that error can be triggered ( source ): user does not have unfiltered_upload capability; WP does not like file type or extension. Latter is checked by wp_check_filetype_and_ext() function ( source ) that filters return through wp_check_filetype_and_ext hook to allow validation of additional file types.

Run script after clicking Set Featured Image in Media

I think what you need is (function(){ var featuredImage = wp.media.featuredImage.frame(); featuredImage.on(‘select’, function(){ var attachment = featuredImage.state().get(‘selection’).first().toJSON(); console.log(attachment); }); })(); The attachment object should have height and width properties.

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