Php 修改注册URL
此代码显示“注册”链接;我想将此链接重定向到www.myDomain.com/register/如何更改此链接Php 修改注册URL,php,wordpress,Php,Wordpress,此代码显示“注册”链接;我想将此链接重定向到www.myDomain.com/register/如何更改此链接 <?php if ( get_option( 'users_can_register' ) ) : $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );``/*** Filter the re
<?php
if ( get_option( 'users_can_register' ) ) :
$registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );``/*** Filter the registration URL below the login form.
** @since 1.5.2** @param string $registration_url Registration URL.
*/echo ' | ' . apply_filters( 'register', $registration_url );endif;?></p>
使用register_url修改返回的url
示例代码将其放在插件或theme/functions.php文件中:
add_filter( 'register_url', 'custom_register_url' );
function custom_register_url( $register_url )
{
$register_url = "YOUR_PAGE_URL";
return $register_url;
}
使用register_url修改返回的url
示例代码将其放在插件或theme/functions.php文件中:
add_filter( 'register_url', 'custom_register_url' );
function custom_register_url( $register_url )
{
$register_url = "YOUR_PAGE_URL";
return $register_url;
}
选中此项:
<?php
if ( get_option( 'users_can_register' ) ) :
echo ' | ' . apply_filters( 'register', 'http://www.myDomain.com/register/' );
endif;
?>
不是很优雅的解决方案,但它应该可以工作。检查以下内容:
<?php
if ( get_option( 'users_can_register' ) ) :
echo ' | ' . apply_filters( 'register', 'http://www.myDomain.com/register/' );
endif;
?>
不是很优雅的解决方案,但它应该可以工作。我认为您必须编辑general-template.php。功能将是
function wp_registration_url() {
return apply_filters( 'register_url', site_url( 'wp-login.php?action=register', 'login' ) );
如果你改成
function wp_registration_url() {
return apply_filters( 'register_url', 'http://www.mydoamin.com/register'));
它应该在引用wp\u registration\u url的地方更改它。我认为您必须编辑general-template.php。功能将是
function wp_registration_url() {
return apply_filters( 'register_url', site_url( 'wp-login.php?action=register', 'login' ) );
如果你改成
function wp_registration_url() {
return apply_filters( 'register_url', 'http://www.mydoamin.com/register'));
它应该在引用wp\u registration\u url的地方更改它。你能告诉我到底要修改什么吗,em不是编码员,对不起,你能告诉我到底要修改什么吗,em不是编码员小心这个,你必须在任何地方都这样做,否则你会在不同的页面上有不同的链接。小心这个,你必须在任何地方都这样做,否则你会在不同的页面上有不同的链接。它会在更新WordPress时中断。在你的主题中添加一个过滤器比编辑核心文件更容易,而且是经得起未来考验的。它会在更新WordPress时中断。添加一个过滤器到你的主题比编辑核心文件更容易,而且是未来的证明。我改变了这一点:$registration\u url=sprintf,esc\u url wp\u registration\u url,uuu'Register';到:$registration\u url=sprintf'myDomain.com/register>register',esc\u url wp\u registration\u url,\uuuuu'register';这样你就必须用注册链接编辑每个模板,核心/主题的更改将在更新时被覆盖。我在我的答案中添加了一个代码示例。我更改了这个:$registration\uURL=sprintf,esc\uURL wp\uregistration\uURL,uuu'Register';到:$registration\u url=sprintf'myDomain.com/register>register',esc\u url wp\u registration\u url,\uuuuu'register';这样你就必须用注册链接编辑每个模板,核心/主题的更改将在更新时被覆盖。我在答案中添加了一个代码示例。