Hot answers tagged

2

No, for this to work reliably you would need to register hooks, which can't be done. The only way to know if a template triggers a hook is to load the template and find out. There is a solution to your problem, but testing if a hook is available is not that solution.


1

I'd guess this code is being run directly from your plugin's functions.php, meaning that you're evaluating is_front_page() and is_archive() as you load the plugin. That's too early - that's before enough state has been initialised to know which page you're on. To fix this, you either need to: move the logic into your say_hello functions, and check ...


1

After testing a lot of things, I found this function, which works: function is_admin_request() { /** * Get current URL. * * @link https://wordpress.stackexchange.com/a/126534 */ $current_url = home_url( ...


1

Using this code you can easy to set update quantity . qty box. i was also try this method it's working fine for me ...I hope it's also helpful thank you :) function wpse_292293_quantity_input_default( $args, $product ) { $productID = $product->id; foreach( WC()->cart->get_cart() as $key => $item ){ if( $item['product_id'] == $productID ...


Only top voted, non community-wiki answers of a minimum length are eligible