简体   繁体   English

WP用户个人资料:在更新个人资料提交时重定向到新页面

[英]WP user profile: redirect to new page on update profile submit

I've added a multitude of custom fields to the backend user profile, divided into sections. 我已将多个自定义字段添加到后端用户配置文件中,分为多个部分。 Each section can be updated using the regular submit button. 每个部分都可以使用常规的提交按钮进行更新。 I have created a checkbox after the last field that when checked, unhides a new Submit button and hides the original submit button. 我在最后一个字段之后创建了一个复选框,选中该复选框时,将取消隐藏新的“提交”按钮并隐藏原始的“提交”按钮。 This new submit button is basically an exact copy of the original Submit button in the user-edit.php file except it is placed within its own div. 这个新的Submit按钮基本上是user-edit.php文件中原始Submit按钮的精确副本,但它放置在自己的div中。

My question is, how do I modify the code for this new submit button so that it still updates the profile like normal BUT then also redirects the user to a page of my choice? 我的问题是,如何修改此新提交按钮的代码,使其仍像常规BUT一样更新配置文件,然后将用户重定向到我选择的页面? Keep in mind that I don't want the redirect effect to take place at times when the original submit button is clicked as there are numerous custom fields and the user will probably want to periodically update before finishing all the sections. 请记住,我不希望在单击原始提交按钮时发生重定向效果,因为有许多自定义字段,并且用户可能希望在完成所有部分之前定期进行更新。

This is the current code for my new submit button (based on the original submit button in user-edit.php) 这是我的新提交按钮的当前代码(基于user-edit.php中的原始提交按钮)

<?php submit_button( IS_PROFILE_PAGE ? __('Send My Completed Application') : __('Send My Completed Application') ); ?>

Try this out using the WordPress built in function. 使用WordPress内置功能进行尝试。

<?php
submit_button( IS_PROFILE_PAGE ? __('Send My Completed Application') : __('Send My Completed Application') );
wp_redirect( 'http://www.example.com', 301 ); exit;
?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM