WordPress login after the landing page and set the user not visible columns, WordPress Landing after the _php tutorial

Source: Internet
Author: User
Tags wordpress default login wordpress login

WordPress login after the landing page and set the user not visible columns, WordPress landing


Close login page after user login
WordPress Default Login page is: Http://WP directory/wp-login.php, login will automatically jump to: Http://WP directory/wp-admin. Now the problem, if the user has logged in, but it opens the wp-login.php page, what will happen? The answer is, WordPress will not do any processing, or directly to show you the login window:

In the face of such a cold login box, users will be confused, I have just logged in? Why do I have to enter a user name and password? Therefore, after the user logs in, we should not let the user see the Login box again. There are two ways to solve this problem:

Remove Login Link

Make sure that the wp-login.php link no longer appears in the page. If the user is not logged in, we can prompt this page:

After the user logs in, we remove the login and registration link above and replace it with:

This will not only allow users to see if they have logged in, and will not mistakenly click wp-login.php to enter the login screen. PHP programming only needs to use the WordPress is_user_logged_in () function to determine whether the user is logged in can be achieved.

wp-login.php do jump

In some cases, users will occasionally click through to the wp-login.php login link, such as the browser's address bar. We should do some remedial work at this time, do not let the login box appear in front of the user. The method described here is that when the user has logged in, but also open the wp-login.php link, we let him jump to the background home Wp-admin, the method is to add the following PHP code in the current topic functions.php:

function Redirect_logged_user () {if (is_user_logged_in () && (Empty ($_get[' action ')] | | $_get[' action '] = = ' Login ') {  wp_redirect (Admin_url ());  Exit }}add_action (' Login_init ', ' redirect_logged_user ');


Create custom columns that are not visible to users
If you are a plugin or theme developer, you should often use custom columns (or custom fields) to store the relevant parameters of your plugin or theme, and interestingly, in the WordPress background post editing page or using the The_meta () template function, WordPress does not display a custom column with a name that begins with _ (underscore).

For some people do not want to let users see, but also do not want users to modify the custom column, we can use this technique, not only to make the article editing page of the custom column simple, and will not let users see unfamiliar custom columns and confused, even random modification. Here is an example of usage:

<?php Add_post_meta ("_ludou", ' Lulu blog ', true);?>

This gives the article ID 68 a unique custom column named _ludou, which is the value of the Lulu blog, and is not visible to users in the article editing page. In normal circumstances, we may use this so that we can see the Ludou field in the custom column of the article edit page:

<?php Add_post_meta ("Ludou", ' Lulu blog ', true);?>

In addition, when the value of the custom column is an array, in the article editing page, the column is not visible to the user, even if the name of the custom column is not underlined.

Articles you may be interested in:

    • WordPress in the guest login to implement email alerts PHP Script instance sharing

http://www.bkjia.com/PHPjc/1087270.html www.bkjia.com true http://www.bkjia.com/PHPjc/1087270.html techarticle WordPress Login After the landing page and set the user not visible columns, wordpress login after user login to close the login page wordpress default login page is: Http://WP directory/wp-...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.