If you gave wp-admin access to some users as editor or contributor etc, they will see those WordPress admin notices, even though those notices are mostly meaningless for them. Not ideal for end users, and often can be confusing. So we will turn off all admin notices for non-admin users… Read More »
Tag: add_action
Hide WordPress update notices for non-admin users
If you gave wp-admin access to some users as editor or contributor etc, they will see those update WordPress notices, even though they can’t perform the update. This is not very comprehensive behavior. So we are going to turn off update notices for non-admin users from wp-admin dashboard by removing… Read More »
Show used coupon details in WooCommerce order email
You may need to show coupon details in the WooCommerce order email. This option is not available by default. We can use woocommerce_email_after_order_table action hook to show used coupon details in order email. This will show coupon details after the order table in the order email. We can get coupon… Read More »
Exclude out of stock WooCommerce products from search result
WooCommerce out of stock products can be excluded from search result by using the _stock_status meta key of products. This meta key checks if a product is in stock or not. We can modify search query using pre_get_posts action hook and load only instock products. Code goes in the functions.php… Read More »
Display all WordPress hooks sequentially for any page
What is the nice and easy way to see all the hooks that run in WordPress during a page load? How do you see them sequentially when things/contents are being loaded? WordPress has a special hook named all which runs for every single hook. From WordPress doc: If you want… Read More »
Show sold out badge to WooCommerce Store
If you are looking for a sold out badge for WooCommerce store out of stock products without a plugin, you are at the right place. Keep going through the article to easily accomplish your goal. A nice ‘sold out’ badge on products image, on the shop page or product category… Read More »
Create an email sending form in WordPress admin using Advanced Custom Fields (ACF)
We can use Advanced Custom Fields (ACF) to create email sending form in WordPress Admin panel easily. This can be useful if you want to create an invitation system or manually send emails to your users or others. We will use wp_mail function with acf/save_post action hook. So when we… Read More »
Show LearnDash enrolled courses on WooCommerce My Account page
We can easily show enrolled courses of current logged in users using the ld_profile shortcode of LearnDash. We can use this shortcode in WooCommerce My Account (user dashboard) page as well. The ld_profile shortcode is actually to show user profile, which contains all enrolled courses with progress. This shortcode will… Read More »
Show LearnDash purchased course details on WooCommerce thank you page
LearnDash integrates well with WooCommerce. But there are certain caveats. When an order is placed for a LearnDash course, from WooCommerce, it only shows regular WooCommerce order data with regular WooCommerce products, which were just purchased. But it doesn’t show anything about the purchased courses. If we can show some… Read More »
Deny PO Box addresses in WooCommerce
Many of you may not want to allow Post Office Box as shipping address. There is no default option in WooCommerce to do it. We can use woocommerce_after_checkout_validation action hook to check if inputted shipping address contains PO Box address or not. Following code checks for the string pobox in… Read More »