Register new user, assign custom role then send email

TO really fit your needs, I think it’s better to rewrite some part of wp_insert_user() function, some part can interrest you $user_email = apply_filters( ‘pre_user_email’, $raw_user_email ); And : $illegal_logins = (array) apply_filters( ‘illegal_user_logins’, array() ); if ( in_array( strtolower( $user_login ), array_map( ‘strtolower’, $illegal_logins ) ) ) { return new WP_Error( ‘invalid_username’, __( ‘Sorry, … Read more

How to access page variable inside action hook

There is method on product class that is called is_on_sale() which actually determines if the product is on sale or not. You can access it from global $product variable. And must echo the do_shortcode. So the whole code will be like- add_action(‘woocommerce_single_product_summary’,’add_product_signup’, 10, 2); function add_product_signup() { global $product; if( $product->is_on_sale() ) { echo do_shortcode(‘[contact-form-7 … Read more

Dynamic name of cron event

So no, I can’t see a way to grab the name of your action. However, you can pass arguments to your callback: $blog_id = get_current_blog_id(); $cron_name=”import_blog_posts_in_network_daily_”.$blog_id; if ( !wp_next_scheduled( $cron_name) ) { wp_schedule_event( time(), ‘daily’, $cron_name, array($blog_id) ); } add_action( $cron_name, array($this, ‘import_blog_posts_in_network’) ); /* public function import_blog_posts_in_network($blog_id) { // do something for blog $blog_id … Read more

Action Hook Inside WordPress Plugin Shortcode

It’s not entirely clear what your ultimate goal is, but a simple way to catch a form submission is to hook init and check if something is set: function wpd_check_post_vars(){ if( isset( $_POST[‘first_name’] ) ){ // do something } } add_action( ‘init’, ‘wpd_check_post_vars’ ); There’s no connection here between the action and your Shortcode, it’s … Read more

Is this the correct way to enqueue style sheets from parent theme and then from child theme in wordpress?

You can try below code. I think there is no need to use wp_enqueue_scripts twice to enqueue the parent and child theme style sheets separately. Also the use of echo get_stylesheet_uri( ); in the enqueue_child_theme_styles function doesn’t make any sense. function my_theme_enqueue_styles() { $parent_style=”styles”; wp_enqueue_style( $parent_style, get_template_directory_uri() . ‘/style.css’, array(‘enough_base’) ); wp_enqueue_style( ‘child-style’, get_stylesheet_directory_uri() . … Read more

Get Taxonomy name from “registered_taxonomy” hook

$args is an array, not an object: function test( $taxonomy, $object_type, $args ) { echo $args[‘name’]; } add_action( ‘registered_taxonomy’, ‘test’, 10, 3 ); EDIT Using the create_term action: function my_create( $term_id, $tt_id, $taxonomy ){ $term = get_term( $term_id, $taxonomy ); echo $term->name; } add_action( ‘create_term’, ‘my_create’, 10, 3 );

How to remove products-links after the product title using remove_action

First, you’re correct that removing the action calling the products_links method would work, and that this is specifically MrBara_WooCommerce->products_links(). In your functions.php, you can just use remove_action without wrapping it in a function used as a callback for another add_action, btw. so: remove_action(‘products_links, array(‘MrBara_WooCommerce’, ‘woocommerce_single_product_summary, 0) 10 is default priority, and while we may assume … Read more