Articles of actions

Automatic user login after registration stopped working

My function stopped working yesterday I checked wp_set_auth_cookie is set. any ideas why? function auto_login_new_user( $user_id ) { wp_set_current_user($user_id); wp_set_auth_cookie($user_id, false, is_ssl()) ; wp_redirect( ‘/welcome/’ ); } add_action( ‘user_register’, ‘auto_login_new_user’,10,1 );

dynamic_sidebar in add_action not showing custom menu widget items text

The custom menu widget and pages widget does not show the text in the li items, but the structure seems to be ok. Anyone have a clue why this might be? Other widgets seem to output the text add_action(‘myAction’, function(){ dynamic_sidebar(‘sidebar-1’); }); here is the menu output…no text in the anchor tags… <div class=”menu-gameplan-container”><ul id=”menu-gameplan” […]

Strange rewrite flush problem

I’ve got a quite strange problem (at lest to me). I setted up some new rewrite rules. They all work properly. But I’m flushing them each time: global $wp_rewrite; $wp_rewrite->flush_rules(false); The very strange thing is that if I comment out the flush code, the rules won’t work anymore. In other words, I’m currently depending on […]

Font Awesome not loaded on first page of website only – divi theme

I am new to WordPress and I created a WordPress website using DIVI theme, I have used font awesome on the website but unfortunately fonts are not loaded on first page of website only, I am getting 404 error on .woff and .woff2 file. Link to website is this I have used this code in […]

$new_pass always returns null – password_reset hook

I am trying to catch the username and the new password to update it on the backup server. I need to fetch $new_pass but the password always returns null. add_action( ‘password_reset’, ‘remote_password_update’ ); function remote_password_update( $user, $new_pass ) { $username = $user->user_login; //THIS WORKS PERFECTLY $password = $new_pass; //THIS ALWAYS RETURNS NULL } This is […]

Add query string variables to all hyperlinks URL in my site

I need to add in the end of any URL in my site (Internal URL OR External URL) this string : http://www.example.com/?utm_source=kam&utm_medium=kam&utm_campaign=kam So I want to add a new string query string variables to all links going out to my site www.example.com like (Referral) What WordPress hooks, actions and filters would I be using to […]

WordPress Logout Failure

We recently started experiencing an issue in 4.7 where admin can’t logout. We added this fix as it was the only one that works. However we are getting a blank page as it is not redirecting to home url. add_action(‘check_admin_referer’, ‘logout_without_confirm’, 10, 2); function logout_without_confirm($action, $result) { /** * Allow logout without confirmation */ if […]

Need data from two different actions

I have two functions on my functions.php Both functions are from a plugin and I’m trying to use this variable $answerIndex in the other action to do the if condition. The issue is I’m trying with global variables but it’s not working, am I doing something wrong? add_action(‘quiz_completed’, ‘mi_ld_quiz_ert’, 10, 2); function mi_ld_quiz_ert( $quizdata, $current_user […]

Set Cookies to Display Form Validation Error Messages

What I am trying to do: I have created a shortcode which renders a form. The form is posting to a page within the same plugin directory includes/handler.php if there is an error with the validation then set a cookie and redirect user back to where they came from and show error. includes/handler.php <?php // […]

Submit to itself don't work

Currently I am creating site wordpress.lockout.lt. One functionality is developed by me; it works fine with the default theme. Currently I am using a different one. And as well this theme requires lot of different plugins. Now, when inserting my plugin shortcode it doesn’t redirect request to itself. Instead I receive a message, that “Page […]