Help hooking into user_register
Help hooking into user_register
Help hooking into user_register
I’m not entirely clear on what you’re trying to do, but it seems you want to pass the user’s email address via a query string and determine the user by that. You can get the user’s ID for writing user meta values from the email value. Use the function get_user_by() to retrieve the user object … Read more
Put CSS Content inside tag for WordPress
This is slightly complicated. I could think of 3 ways to do this: Use someone else’s importer plugin. Importing stuff into WP using complicated criteria is a solved problem. However, I’ve never met an importer plugin that I liked which was free. Most of the projects I work on have less cash and more developer … Read more
You could hook into template_redirect and execute a helper function: add_action( ‘template_redirect’, ‘wpse_75558_count’ ); function wpse_75558_count() { if ( is_singular() ) setPostViews( get_the_ID() ); } To display the post views, you have to use a later hook. I would recommend the_content: add_filter( ‘the_content’, ‘wpse_75558_show_count’ ); function wpse_75558_show_count( $content ) { $count = getPostViews( get_the_ID() ); … Read more
How to abort a save operation with a WordPress hook?
You’d better use woocommerce_email_order_items_args filter. It can be done this way: function add_product_thumbnail_to_wc_emails( $args ) { $args[‘show_image’] = true; $args[‘image_size’] = array( 100, 100 ); return $args; } add_filter( ‘woocommerce_email_order_items_args’, ‘add_product_thumbnail_to_wc_emails’ ); The code has to be placed to functions.php
I managed to solve this issue using pre_get_termsas an action and then updating the query_vars $current_user = get_current_user_id(); $user_field = “user_”.$current_user; $user_categories = get_field(‘post_categories’, $user_field); if(in_array(‘category’,$terms->query_vars[‘taxonomy’])){ $terms->query_vars[‘include’] = $user_categories; } return $terms;
I figured out it could be an Authorization problem, then I looked the WooCommerce webhook functions and fount where the delivery is executed: /wp-content/plugins/woocommerce/includes/class-wc-webhook.php I hard coded my Authorization header after line # 303 in the deliver() function: ‘headers’ => array( ‘Content-Type’ => ‘application/json’, ‘Authorization’ => ‘Basic bmNkaWgdrGFsOiNIb25kdXJhczIwMThTUFMh’, ), Now I need to calculate the … Read more
Your header.php file is going to be called after the init action. If you want the logic to run in your header.php file first, maybe you can hook into another action done at a later point in WordPress: add_action(‘wp_head’, ‘ax_get_user_info’); function avox_get_user_info() { if (is_user_logged_in()) { $currentUser = wp_get_current_user(); $fName = $currentUser->user_firstname; } return $fName; … Read more