gpt4 book ai didi

wordpress - 显示不带 'http' 的 wp 作者元 url

转载 作者:行者123 更新时间:2023-12-02 22:17:47 26 4
gpt4 key购买 nike

我正在使用 WP 函数:get_the_author_meta('user_url');

当我将其回显给浏览器时,它会自动在 URL 前添加“http://”。我怎样才能避免这种情况,以便我的 URL 显示与在用户设置页面上输入的完全一样。

提前致谢。

最佳答案

$author_url = get_the_author_meta('user_url'); // e.g. http://www.example.com
$to_remove = array( 'http://', 'https://' );
foreach ( $to_remove as $item ) {
$author_url = str_replace($item, '', $author_url); // to: www.example.com
}
echo $author_url; // now it will not have the http:// part you wish to avoid.

关于wordpress - 显示不带 'http' 的 wp 作者元 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14189918/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com