get_header and hook avoid normal call

No, you cannot do that, unfortunately, because get_header( $name ) doesn’t have a filter for the $name (it only passes the name with the action call). However, if you are willing to modify the header.php file for each site with something like this right at the beginning of the file: <?php if ( apply_filters( ‘load_custom_header’, … Read more

Can I remove WooCommerce main content hook?

remove_action(‘woocommerce_before_main_content’, ‘woocommerce_output_content_wrapper’, 10,0); remove_action(‘woocommerce_before_main_content’, ‘woocommerce_breadcrumb’, 20,0); remove_action(‘woocommerce_after_main_content’, ‘woocommerce_output_content_wrapper_end’, 10,0); I hope it works for you =)

WordPress action and filter hooks runs asynchronously?

Actions and filters are resolved in a linear fashion when processing the request. They do not run asynchronously. If you have some heavy processing that runs during every request (i.e. you use action and filter hooks that run during every page load for every user, like template_redirect, init or whatever usual hooks you might be … Read more

WooCommerce: Add Payment Gateway Field to Webhooks [closed]

Thanks, will do next time. I figured this one out: function my_custom_wc_api_order_response( $order_data, $order, $fields ) { $customer_info = get_post_meta( $order->id, ‘_customer_info’, true ); $order_data[‘payment_details’][‘customer_info’] = $customer_info; // Apply filters if necessary if ( $fields ) { $order_data = WC()->api->WC_API_Customers->filter_response_fields( $order_data, $order, $fields ); } return $order_data; } add_filter( ‘woocommerce_api_order_response’, ‘my_custom_wc_api_order_response’, 10, 3 );

How to preserve edits to Name or Slug of term when using wp_update_term on save?

So, thanks to cjbj I finally found the correct answer! I needed to use edited_term instead of edit_term. Very subtle difference. edited_term fires after a term has been saved. // insert stuff into description field of taxonomy function insert_taxonomy_content( $term_id, $tt_id, $taxonomy ){ // only insert content on certain taxonomies if ( $taxonomy === ‘some_custom_taxonomy’ … Read more

Can I fire an add_action hook inside of a function that recieves data via wp_ajax?

I guess you have a small misunderstanding here (a slight inconsistency only) add_action is to register a callback for a hook-name, you actually want to fire that hook (not register it). You can fire a hook with the do_action function. The Codex-page of the add_action function outlines both: https://developer.wordpress.org/reference/functions/add_action/ And naturally the do_action Codex-page has … Read more

How to delete an user including data from custom database tables

Hello guys! i resolved this issue by using same hook add_action( ‘delete_user’, ‘my_delete_user’ ); here is my code <?php function my_delete_user( $user_id ) { global $wpdb; $user_obj = get_userdata( $user_id ); $id_user = $user_obj->ID; $idsss = $user_obj->user_id; /*Delete Data from friend table*/ $query_friend= $wpdb->query(“DELETE FROM `wp_user_friends` where `friend_id` = “.$user_obj->ID.””); /*delete data from group*/ $delete_group_table … Read more

wp_login Action hook with conditional tag

This should work for you, make sure that the user_login or user_id matches to the string you’re using in the condition. Try to do a var_dump($user_login); And about the function you’re using, you don’t need to grab the global or call get_current_user();, because the action you’re calling already pass two parameters to your function, the … Read more