How to store media files in subdomain

You can move the uploads folder to the sub domain by doing this Open up your wp-config.php file, located at the root of your WordPress installation, and add the following code: define(‘UPLOADS’, ‘http://images.mydomain.com/uploads’); The codex specifies that it should be added before the line that says require_once(ABSPATH.’wp-settings.php’);. Make sure the uploads folder is writable.

Get link of inserted media file of post within loop

You can get attachment URL like this. <?php if ( have_posts() ) : while (have_posts()) : the_post(); ?> <a href=”https://wordpress.stackexchange.com/questions/163795/<?php $featured_image_url = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ),”full’ ); echo $featured_image_url[0]; ?>”> <?php the_title(); ?> </a> <?php endwhile; endif; ?> First you will need to get the attachment ID so you will need to get it from … Read more

custom image size with New Media Manager in wordpress 3.5

You will need to paste your code in order for us to review where the issue is, however, I can demonstrate how I accomplish this in WordPress v3.5 Please observe the comments in my_insert_custom_image_sizes: function my_insert_custom_image_sizes( $sizes ) { // get the custom image sizes global $_wp_additional_image_sizes; // if there are none, just return the … Read more

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