Media permalinks on local and remote server

Question

I am trying to include images and pdf in my WordPress post content. The problem is the permalink I am using only works on local and not on the hosting platform. As all the media files are in the upload directory of WordPress installation I thought of using the ‘wp_upload_dir()’ and accessing the base URL of the domain to link the media files so that they would work on both the platform(dev and remote server). After trying it out I found out that WordPress post/page editor doesn’t allow the use of PHP code. So what I trying to find out is that is there any way to access media files with an independent URL so that it works on any platform.

Some context

<!-- WordPress post editor -->
<!-- Local Path -->
<a href="/wp-content/uploads/1/test.pdf">Click to see the PDF</a>
<!-- Remote Path -->
<a href="mysite.com/wp-content/uploads/1/test.pdf">Click to see the pdf</a>

Something that would eliminate the process of changing the url of all the media i am trying to display in the wordpress post content when importing to remote server.

Thank you for your help 🙂

0
, nash08 7 months 0 Answers 69 views 0

Leave an answer