This problem is also well solved. Just put the following php code in functions. php of the current topic:
The code is as follows: |
Copy code |
Add_filter ('logout _ url', 'ludou _ logout_redirect ', 10, 2 ); Function ludou_logout_redirect ($ logouturl, $ redir ){ $ Redir = 'http: // www.111cn.net/'; // enter the URL you want to jump. Return $ logouturl. '& amp; redirect_to ='. urlencode ($ redir ); } |
In this way, you can click exit in the upper-right corner of the background page to jump to the specified page. If you want to add an exit link at the front-end, click it to log out and jump to the specified site page, you can use the following code (the URL in the code is changed to yours ):
The code is as follows: |
Copy code |
<? Php if ($ user_ID) {?> <A href = "<? Php echo wp_logout_url ('http: // www.111cn.net/');?> "Title =" Logout "> Logout </a> <? Php }?> |
To jump to the homepage, you can use the following code:
The code is as follows: |
Copy code |
<? Php if ($ user_ID) {?> <A href = "<? Php echo wp_logout_url (home_url ();?> "Title =" Logout "> Logout </a> <? Php }?> |
To jump to the page before exiting, use the following code:
The code is as follows: |
Copy code |
<? Php if ($ user_ID) {?> <A href = "<? Php echo wp_logout_url (home_url (add_query_arg (array (), $ wp-> request);?> "Title =" Logout "> Logout </a> <? Php }?> |