Admin: how to make a custom list filter button send GET queryvars

Thanks to @cybmeta I was able to solve my issue. Below I post all the relevant code. Keep in mind it refers to a ‘distributor’ custom post type that uses 4 custom taxonomies (‘italy’,’france’,’spain’,’world’). // add columns function add_distributor_columns($table_columns){ $area_column = array(‘area’ => ‘Area’); $macroarea_column = array(‘macroarea’ => ‘Macroarea’); // put them on the right … Read more

Want to use wp_get_current_user() in query filter

since the query filter is “applied to all queries (at least all queries run after plugins are loaded)” as stated here in the wordpress codex you should do a further test to make sure that you are in the query you want to be. Perhaps a certain query or queries is/are run before the one(s) … Read more

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

WooCommerce coupon hook argument NULL when using filter woocommerce_get_shop_coupon_data

You need to tell add_filter how many arguments it accepts (2) example: add_filter(‘woocommerce_get_shop_coupon_data’, array( $this, ‘filter_woocommerce_get_shop_coupon_data’ ), 10, 2 ); Be sure to enable WP_Debug – http://wpexplorer-themes.com/total/docs/enabling-wp-debug/ – on your server, because you should have gotten an error when trying to do this without the added argument. Also I highly recommend using static classes when … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)