Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to close the login page and set the user invisible column in WordPress

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Editor to share with you how to close the landing page and set the invisible column for users in WordPress, I believe most people don't know much about it, so share this article for your reference. I hope you can learn a lot after reading this article. Let's learn about it together.

Close the login page after the user logs in

The default login page for WordPress is: http://WP directory / wp-login.php, which automatically jumps to: http://WP directory / wp-admin after login. Now the question is, what happens if the user is logged in and it opens the wp-login.php page? The answer is, WordPress won't do any processing, or will it just show you the login window:

Faced with such a cold login box, users will be confused. Haven't I just logged in? Why do I have to enter my 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 links

Make sure that the link to wp-login.php no longer appears on the page. If the user is not logged in, we can prompt you on the web page as follows:

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

This will not only let users know whether they have logged in at a glance, but also will not mistakenly click wp-login.php to enter the login interface. PHP programming only needs to use WordPress's is_user_logged_in () function to determine whether the user has logged in or not.

Wp-login.php does the jump.

Sometimes, after logging in, users will occasionally click on the wp-login.php login link, such as the browser's address bar. It's time for us to take some remedial measures and don't do nothing to show the login box in front of the user. The method described here is that when a user is logged in but opens the wp-login.php link, we ask him to jump to the backend home page wp-admin by adding the following php code to the functions.php of the current topic:

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 invisible to the user

If you are a plug-in or theme developer, you should often use custom columns (or custom fields) to store parameters related to your plug-in or theme. Interestingly, in the WordPress background article editing page or using the the_meta () template function, WordPress will not display custom columns whose names begin with _ (underscore).

For some custom columns that do not want users to see, let alone modify, we can use this technique to not only simplify the custom columns of the article editing page, but also not let users feel confused when they see the custom columns that they are not familiar with, or even modify them randomly. The following is an example of usage:

This adds a custom column named _ ludou to the article with an id of 68, and the value is the only custom column of the Ludou blog, and users can't see it on the article editing page. Normally, we might use this so that we can see the ludou field in the customized column of the article editing page:

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

The above is all the contents of the article "how to close the login page and set the invisible column for users in WordPress". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report