What hook do I use if I want to update a user profile field when a new user is created?
You’d want to use the user_register hook, which fires immediately after the new user’s username and (hashed) password are saved to the DB.
You’d want to use the user_register hook, which fires immediately after the new user’s username and (hashed) password are saved to the DB.
I found a solution for this problem: For some reason, the add_action() and remove_action() had to be contained inside another action, genesis_meta: add_action( ‘genesis_meta’, function () { if (is_404()) { remove_action( ‘genesis_loop’, ‘genesis_404’ ); add_action( ‘genesis_loop’, ‘genesis_customizations_404’ ); } }, 11);
So, the plugin isn’t wrapping it in any class which is nice and easy for us. We can’t modify the function directly and it doesn’t appear to have any filters so what we can do one of 2 things ( which is essentially the same ). 1) If on most pages you don’t want this … Read more
The first time that save_post fires it is when WordPress is creating an auto draft. See Why does save_post action fire when creating a new post? To fix, just check to see if the passed $post variable has a post status of auto-draft. add_action( ‘save_post’, ‘my_save_post’, 10, 3 ); function my_save_post( $post_id, $post, $update ) … Read more
If the file isn’t an image, its mime type is checked against the allowed list. As your example would generate a text mimetype, and it’s an allowed file extension, it passes through. There should be no concern unless your server is executing image files as PHP, in which case this issue is the least of … Read more
Thanks a lot to Nathan Johnson: The solution was to use instance of the class the action was defined in. The class was globalized in the theme after instantiation. So the adding the below code to functions.php of a Child Theme worked: function remove_woo_forms_hooks() { global $woo_a; remove_action(‘woocommerce_before_customer_login_form’, array($woo_a,’before_customer_login_form’)); } add_action( ‘after_setup_theme’, ‘remove_woo_forms_hooks’,0);
The priority argument of add_action and remove_action need to be the same. Since wm_menu_social is hooked at 130 you need to specify 130 when removing it: remove_action( ‘tha_header_top’, ‘wm_menu_social’, 130 );
The use of add_action() seems backwards to me. A better approach would be to hook homepage_content() into the homepage hook and then just output each section within the one hook: function homepage_content() { $the_id = 5; $item = get_post( $the_id ); $page_tree_array = get_pages( array( ‘child_of’ => $the_id ) ); foreach( $page_tree_array as $item ) … Read more
You add the following snippet to your theme’s functions.php file; The “wp_insert_term_data” filter allows you to modify a term’s name, slug or term_group before it is added to the database. This works for terms added via WP All Import and also manually through admin as well. The filter passes all taxonomy terms, not just woocommerce … Read more
When there’s an issue such as yours, there is probably 1 function stuck somewhere that delays the loading. You can retrieve a list of all functions attached to a hook this way: global $wp_filter; $actions = $wp_filter[‘init’] ; Now you can remove the functions from the hook one by one, by using remove_action() and see … Read more