Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

login

How do I require authorization / login to view a specific set of posts / pages?

This is just a modification of timshutes’ answer – if you want specific pages to require login and don’t want to put them into a custom post type, you can add to functions.php: add_shortcode(‘need_login’, ‘shortcode_needLogin’); function shortcode_needLogin() { if (!is_user_logged_in()) { auth_redirect(); } } And then at the top of the pages you want to … Read more

Categories custom-post-types Tags authentication, custom-post-types, login, password, private

How to show ‘login error’ and ‘lost password’ on my template page?

Yes it’s possible. You have to create three filters for this. Admin stuff inside a class class WPSE29338_Admin { public static function setup() { add_filter(‘login_url’, array(__CLASS__, ‘modifyLoginURL’), 10, 2); add_filter(‘lostpassword_url’, array(__CLASS__, ‘modifyLostPasswordURL’), 10, 2); add_filter(‘register’, array(__CLASS__, ‘modifyRegisterURL’)); } public static function modifyLoginURL($loginUrl, $redirect=””) { $loginUrl = site_url(‘login’); // Link to login URL if(!empty($redirect)) { $loginUrl … Read more

Categories login Tags front-end, login

Removing username from the ‘wordpress_logged_in’ cookie

Short introduction After quick look inside WP source code, I think I’ve found solution… WordPress uses two functions to set and parse auth cookies: wp_generate_auth_cookie wp_parse_auth_cookie There is a filter in wp_generate_auth_cookie called auth_cookie which you probably could use to change the contents of cookie, but there is no filter inside wp_parse_auth_cookie, but… Both of … Read more

Categories login Tags cookies, login, session

‘Password field is empty’ error when using autofill in Chrome

The JavaScript function wp_attempt_focus is causing this issue. The function fires shortly after page load, clears the form and focuses on it, forcing users to manually enter their login information. Chrome is filling in the username and password automatically, just milliseconds before the JS function clears the field. Chrome does not properly pick up the … Read more

Categories login Tags errors, google-chrome, login

I can’t access my site via wp-admin

Try disabling all your plugins by moving or deleting them from your /wp-content/plugins/ folder. Do this by FTP or by your host’s control panel. If this doesn’t work, log in to the server via FTP, and upload a fresh copy of WordPress. This will fix your wp-admin, and any other folders or files that have … Read more

Categories login Tags login

Disallow user from editing their own profile information

great answer, to take this a step further and for anyone looking to apply this to all non-admin users (e.g. contributers, editors etc.) // ===== remove edit profile link from admin bar and side menu and kill profile page if not an admin if( !current_user_can(‘activate_plugins’) ) { function mytheme_admin_bar_render() { global $wp_admin_bar; $wp_admin_bar->remove_menu(‘edit-profile’, ‘user-actions’); } … Read more

Categories login Tags login, profiles, user-roles

Enqueue a stylesheet for login page and make it appear in head element

For every enqueue action, there is a corresponding print_styles action: wp_enqueue_scripts → wp_print_styles admin_enqueue_scripts → admin_print_styles customize_controls_enqueue_scripts → customize_controls_print_styles Not for the login page. There is no login_print_styles action or function, so your stylesheets are thrown out on do_action( ‘login_footer’ );. But there is a simple fix: if ( ! has_action( ‘login_enqueue_scripts’, ‘wp_print_styles’ ) ) … Read more

Categories theme-development Tags css, login, theme-development, wp-enqueue-style

How to Change the Default Home Page for the WordPress Dashboard?

Easy enough, decided to just do the redirect option. I used the wp_login action hook. You could also probably use this for redirecting your users to ANY page on your website. You can also check user capabilities from the $user Object passed in as a function parameter if you want to send different user levels … Read more

Categories admin Tags admin, authentication, dashboard, login, wp-admin

Is there a is_user_logged_in() for multisite?

Yes, and no! The way users work in a multisite scenario is that there is a single pool of users, who are then associated with blogs. So, logged in status is common across all the blogs, but you can use is_blog_user($blog_id) to determine whether the current logged in user is a member of that blog. … Read more

Categories multisite Tags functions, login, multisite, users

Check for correct username on custom login form

The code he posted in that tutorial (very nice BTW) post’s the form to the build-in “reset password” module which redirects to the login.php on error, but you can change that and build your own based on the original and add it to the template page, change: <form method=”post” action=”<?php echo site_url(‘wp-login.php?action=lostpassword’, ‘login_post’) ?>” class=”wp-user-form”> … Read more

Categories login Tags forms, login, password, Reset
Older posts
Newer posts
← Previous Page1 … Page158 Page159 Page160 … Page162 Next →
+ More

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
Next Page »
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress