I want to disable E-Mail verifcation / activation when a user signs up for my Wordpress site

when a new user registers an activation link is sent to his e-mail account. I want the user to enter his username, email address and password and straight register and be logged in without confirmation (confirmation does not prevent spam bots from signing up for the site, I don't care about it really!) is there a way to do it?
Category: Web

Redirect after login to current URL

I've my login box on any page of my WordPress and I'm trying to redirect to the same page after a user logs in. For example: If I make the login in the URL http://localhost/wordpress/category/sub-category/sold, redirect to the same URL. I've this in my functions.php but, using my $url doesn't work. How can make the redirection? function login_go_home(){ //$url ="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; wp_redirect(home_url()); exit(); }
Category: Web

Using gettext on wp-login.php won't change "Back to site name" text

I'm attempting to change the "← Back to sitename" text on the wp-login.php page using gettext but not having much luck. No matter what I try it doesn't seem to want to work, although I've had success changing the "Lost your password?" text using the same method. Here is my latest snippet function custom_login_text ( $text ) { if (in_array( $GLOBALS['pagenow'], array( 'wp-login.php', 'wp-register.php' ) )) { if ($text == '← Back to %s'){$text = 'Test';} return $text; } } …
Category: Web

Basic Auth .htaccess on wp-login, but allow logout from woocommerce

I use a .htaccess basic auth on my WC site to help prevent hackers accessing wp-login, which works well... except with WooCommerce if a logged in customer wants to logout from their account - upon clicking the logout link - they are greeted by the Basic Auth popup asking them to "authorise" (generated by our .htaccess). On Woocommerce dashboard: Hello MrTest (not MrTest ? Log out) << clicking on "Log out" brings up the Basic Auth login box.... how can …
Category: Web

Can we intercept user_login and user_pass from a wp_login_form?

with my plugin, I have a login form. I use the wp_login_form() function of Wordpress. As you know, this function links to the wp-login page. But if the user_login is not present or if the email is empty in the database, an error will be present. My users come from an external database. Imagine the following situation: A user from my external database connects for the first time on the site, so he is not in the wp_users table of …
Category: Web

Using wp_login vs login_redirect to redirect based on user-meta

I wrote a function to redirect first-time users using login_redirect, and it was working great. Then I changed the hook to wp_login (to get it to play well with a social login plugin), and now the function is redirecting all users who sign in via the wp_login_form. PS: the redirect works fine when logging in via my social login plugin. Is there a difference between wp_login and login_redirect, or is something wrong with the conditional php? Here's the code: //Hook …
Category: Web

Redirect already logged in users away from a page to a specific page base on user role

I'm trying to accomplish this simple task through different plugins, but I can't find the right one for different reasons. I have a Login Page with a login form. When user logs in, he's redirected to a specific page (based on user role). If the user visits again the Login Page, the login form displays a Welcome message with dashboard, profile and logout links (see pics). Since I need to avoid that and need logged in user to only visit …
Category: Web

How to change form action of wp-login page with a function

I'm manually creating my own Wordpress login form. The action parameter of all the forms points to wp-login.php. I want to change it for all of them to custom url (/login). Any idea how to that? For example: <form name="lostpasswordform" id="lostpasswordform" action="http://mywebsite.com/wp-login.php?action=lostpassword" method="post"> So I want to change the form action into mywebsite.com/login/?action=lostpassword Note, I need for both Login, Register and Lost Password. Kind regards.
Category: Web

How to add custom authentication to wordpress login and register

I want to create a function that will halt the login process in wordpress and let a user to validate an otp form or code before he logins in fully. And i intend this interception to be just after the users email and password This is what i tried add_filter( 'authenticate', 'smyles_check_custom_auth', 10, 3 ); function smyles_check_custom_auth( $user, $username, $password ){ $otp_check = 'bad'; // variable returned from query but just using bad for testing if( !$otp_check == 'good' ){ …
Category: Web

Disable Remember Me in Login Form

I need to disable the 'Remember Me' prompt in login screens. Based on answers here https://wordpress.stackexchange.com/a/306746/29416 (including my own answer from 2018 with code that I had working then) about disabling the "Remember Me" prompt on the WP login form (wp-login.php), I should be able to do this: add_filter('login_form_defaults', 'my_disable_remember_me'); function my_disable_remember_me($args) { $args['remember'] = ""; return $args; } This is based on looking at wp-login.php (around line 604) where the 'remember' arguments shows the 'Remember Me' prompt. If the …
Category: Web

Check for $ _POST fields in a POST method form

I'm trying to check if the username and password fields are present in the login form. The problem is that the if (!empty ($_POST)) code does not do this to me. UPDATE: if (isset($_POST['submit-btn'])) { //Sanitize POST Array $POST = filter_var_array($_POST, FILTER_SANITIZE_STRING); $username = $POST['username']; $password = $POST['password']; if(empty($username)) { echo "Username o email non inserita"; return false; } if(empty($password)) { echo "Password non inserita"; return false; } if($username && $password) { $login_array = array(); $login_array['user_login'] = $username; $login_array['user_password'] = …
Category: Web

How would you set Theme Customizer API Previewer Preview URL of a Logged out Page or Login Screen

How would you set the WP_Customizer preview iframe to a Logged out page like the Login Screen /wp-login.php? I'm aware of how to set the preview page on expansion of panels or sections, but I have some subtle theme mods for the login screen I'd like the user to preview when customizing. Any Ideas? I looked at the code to some Custom Login plugins and it appears they might print out a fake clone or duplicate of the login page …
Category: Web

How to enable “remember me” checkbox in login forms by default?

I have wordpress website and i want to enable "remember me" checkbox on login forms by default because lot of user would like to login all the time until they will delete cookies. If the user does not want to be remembered, they can just uncheck the checkbox.Even i tried plugin (don't remember plugin name) but that plugin starts crashing my website. Is there any code to solve this problem?
Category: Web

Customizing Wordpress Login URL

I would like change the default login URL for WordPress, i.e. www.website.com/wp-admin to something else that is custom and will be hard for visitors to try and hack their way in.
Category: Web

Auto login from custom registration form

I am trying to login a user from custom user registration form. My Code for Custom user Register is function register_user($data) { $userdata = array( 'user_login' => $data['email'], 'user_email' => $data['email'], 'user_pass' => $data['pssword'], 'user_nicename' => $data['fname'], 'display_name' => $data['fname'], ); $usermetedata = array( 'son_name' => $data['son_name'], 'shape' => $data['shape'], 'siret' => $data['siret'], 'company_email' => $data['company_email'], 'company_activity' => $data['activity'], 'staff' => $data['staff'], 'position_held' => $data['position_held'], 'company_phone' => $data['company_phone'], 'company_mobile' => $data['company_mobile'], 'company_address' => $data['company_address'], 'company_postal' => $data['company_postal'], 'company_ville' => $data['company_ville'], …
Category: Web

Redirect per shortcode if user is logged in

I want to put the wordpress login screen on my homepage. If a user is not logged in I want them to have to enter their username and password into the box (or sign up).. and if they are logged in, I want them to be redirected to the overview page. Everything works fine if the user is not logged in, but if they are logged in the redirect isn't working.. Can someone please tell me what's wrong with my …
Category: Web

Open login logo URL in new tab

Using add_filter('login_headerurl', fn() => FRONTEND); i was able to change the login logo URL. But i couldn't find a way to make it open in a new tab. Or in other words, how can i add target="blank" to the login Logo link? Kinda like: <h1><a href="https://ex.com/" "title="Some title" target="_blank">Site Name</a></h1>
Category: Web

Modify WP-Login Page With Javascript?

This may be a 'noob' question, but... It doesn't seem possible to modify the WP-Login page via PHP (eg. add the get_header() code or new DIVs) to match the site theme. That is, without hacking the core, of course. (If there -is- a way to do this, please let me know!) And -yes- I am aware you can create a login template, but you can never get -rid- of WP-Login because it seems necessary for various core login/logout functions. (Again, …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.