dongwei1263 2018-10-25 10:02
浏览 252

WordPress添加视频媒体以在源中接收绝对URL

After I added a video to WordPress post, from the text tab, I can see the shortcode:

Screenshoot of shortcode after adding video

The current source of the video is a relative URL: "/wp-content/uploads/...".

What I need is after adding video, the shortcode should be:

"[video width="1280" height="720" mp4="https://mywebsiteurl.com/wp-content/uploads/2018/10/SampleVideo_1280x720_2mb.mp4"][/video]"

which means the source of the video is an ABSOLUTE URL: "https://mywebsiteurl.com/wp-content/uploads/...", not just "/wp-content/uploads/...".

I checked the host setting in wp-config.php, there is a line:

// WP_CONTENT_URL can be set to enable relative URLs to /wp-content
// but if undefined, it simply defaults to absolute URLs.

So I added "//" to this define:

// define('WP_CONTENT_URL', 'https://mywebsiteurl.com/wp-content/');

This works for all images and in the attachment detail (even for the attachment details of video media), the URL shows absolute link.

But, adding video still generates a relative URL. What am I doing wrong?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 算法题:数的划分,用记忆化DFS做WA求调
    • ¥15 chatglm-6b应用到django项目中,模型加载失败
    • ¥15 武汉岩海低应变分析软件,导数据库里不显示波形图
    • ¥15 CreateBitmapFromWicBitmap内存释放问题。
    • ¥30 win c++ socket
    • ¥30 CanMv K210开发板实现功能
    • ¥15 C# datagridview 栏位进度
    • ¥15 vue3页面el-table页面数据过多
    • ¥100 vue3中融入gRPC-web
    • ¥15 kali环境运行volatility分析android内存文件,缺profile