There is a domain option (like a CDN), it is used in link building. If the option changes - the links are "flying". How to save it so that files uploaded after changing an option change a host? What ways are there for this?

You just need the plugin option to be used both by the widget and when building the url when the file is taken from the media library.

  • It would be necessary to reformulate the question. What is the problem? To work with cdn, nothing — absolutely nothing — is not necessary to change in WP. It seems your question was about Autoptimize. There is a cdn base url path, but only this plugin needs it. - KAGG Design
  • I am writing my plugin. Pictures are saved - and cdn in settings. I dig in the direction of adding an arbitrary field. When loading an image. - Timur Musharapov

1 answer 1

Use relative links, for example. And the domain for building absolute links store in an arbitrary field. If I understand you correctly