As of WordPress formiruet the link to the image?

As of WordPress formiruet the link to the image?

As well as you can use the filter for example or something else to change the domain for the images?
June 14th 19 at 20:39
2 answers
June 14th 19 at 20:41
Solution
When uploading images, WP writes the absolute image URL in the wp_posts table in the guid column. Examine the structure of the database to understand.

The link itself is formed of these components:

1. The Home URL is the root url of the site
2. Upload Dir - the root downloads folder, she wp-content/uploads
3. Folder dates, if the corresponding option is enabled - for example 2017/10
4. File name

Domain for images can be changed using the filter:
add_filter( 'pre_option_upload_url_path', function( $upload_url_path ) {
 return 'http://images.example.ru';
});
And if the images are already there, there is a similar filter for this? - moses_Zboncak commented on June 14th 19 at 20:44
To obtain the URL under the hood, use the function wp_get_attachment_url(), it has a filter wp_get_attachment_url. But there is so dynamically is going to a url, I wrote in the answer about it. - Velva.Rogahn commented on June 14th 19 at 20:47
Thank you! All what you need. - moses_Zboncak commented on June 14th 19 at 20:50
By the way found another method:

Open this link /wp-admin/options.php

https://website.com/wp-admin/options.php

Next in the list and change: upload_url_path - moses_Zboncak commented on June 14th 19 at 20:53
that's not a way, and breaking the kernel. first, at the first update of WP will be overwritten. secondly, you may have side effects. third - just remember once and forever that you can't climb the core files are absolutely not necessary unless you are doing core contribution. - Velva.Rogahn commented on June 14th 19 at 20:56
June 14th 19 at 20:43
The first question is not understood.

The second was done with the plugin WP Original Media Path.
Not sure what the plugin as it will help on a multilingual website. And something tells me that it does the same thing that I have identified as a solution. - moses_Zboncak commented on June 14th 19 at 20:46

Find more questions by tags WordPress