我有一个 WordPress 网站。 https://dogx.hu 我还有一个 Laravel 电子商务网站。主要目标是从 WordPress 站点的“/shop”URL 重定向到 Laravel 站点。因此,当用户访问dogx.hu/shop 时,会向他们显示电子商务网站。
有人可以帮助我吗?非常感谢!
提前致谢!
我尝试重定向,但还不够。我有错误。
您可以将其添加到子主题的functions.php'文件中:
function custom_redirect_shop_page_atakanau() {
if ( is_shop() ) {
wp_redirect( 'https://domain.tld/custom-url' );
exit;
}
}
add_action( 'template_redirect', 'custom_redirect_shop_page_atakanau' );
访问商店页面时,此代码会重定向到自定义 url。