I am currently receiving 2 e-mails a day asking me to update a Wordpress multisite I once worked on...and I am starting to get desperate!
Things I have tried:
I have changed my email adress both for the admin user and in the general settings.
I have tried adding the following to the functions.php file:
apply_filters( 'auto_core_update_send_email', false);
add_filter( 'auto_core_update_send_email', '__return_false');
apply_filters( 'send_core_update_notification_email', false);
..without any luck.
An obvious solution would be to just update :), but I am hoping to solve this problem once and for all since I am no longer taking this kind of work and have lots of other sites I have worked on in the past.
Any suggestions would be very welcome!
You almost have the correct answer. Change apply_filters to add_filter. Also you need to use '__return_false' which is a hook that just returns false. Using false directly won't do anything. Here's the complete version:
// This stops emails being sent to you after an automatic update.
add_filter( 'auto_core_update_send_email', '__return_false' );
// This stops emails being sent to you to notify you of a new core update.
add_filter( 'send_core_update_notification_email', '__return_false' );
Related
I've been struggling with this for a couple days now and have been through every post/comment/discussion/etc... I could find trying to find a working solution.
I want to send an email via a custom class that extends WC_Email whenever a woocommerce user updates their address. I've found various resources explaining how to create custom wc emails (skyverge was most useful) and I have successfully done that. I have a plugin that adds a custom email in WP-Admin->WooCommerce->Settings->Emails.
If I use an action that is already part of the woocommerce_email_actions such as add_action( 'woocommerce_order_status_failed_to_processing_notification', array( $this, 'trigger' ) ); and manually change the order status in the backend everything works just fine.
Problem is I want to use add_action( 'woocommerce_customer_save_address', array( $this, 'trigger' ) ); and unfortunately it never fires.
Based on some other threads I've tried adding the following to my main plugin file
function new_woocommerce_email_actions( $actions ){
$actions[] = 'woocommerce_customer_save_address';
return $actions;
}
add_filter( 'woocommerce_email_actions', 'new_woocommerce_email_actions' );
Supposedly this should allow me to use the action in my custom class, but no luck. I've also tried adding other actions without any success. For instance using the filter to add woocommerce_order_status_cancelled won't fire when manually changing the order to cancelled. I'm struggling to figure out why this isn't working and most of the the threads I've found are 2+ years old and dead, so here I am. Any help or pointers would be greatly appreciated.
Posting as an answer in case others are trying to get this functionality working.
I found this article from Tyche Softwares after extensive digging and was able to create a plugin that will send a custom WC_Email whenever a customer updates their address information.
I'm still not 100% as to why the add_filter('woocommerce_email_actions'... wasn't working, and if anyone can tell me why I'd still be interested.
This plugin works by calling a custom action defined in my extended WC_Email class via do_action whenever the existing woocommerce_customer_save_address action happens.
I have a woocommerce site setup where I have once specific user created for an answering service. Because multiple 'customers' will be using this one account, I need to disable woocommerce's persistent shopping cart for one specific user ID so that if two operators are talking to two different customers at the same time on different computers, their shopping carts won't be linked. I have yet to see anywhere how I can turn off a persistent cart for woocommerce, let alone for specific users. Can anyone help? Thanks!
EDIT:
After a lot of searching I found this great tutorial https://jhtechservices.com/woocommerce-persistent-cart-issue/ which I followed but doesn't seem to be working. Does anyone have any suggestions?
Woocommerce since 3.4 has special filter:
add_filter( 'woocommerce_persistent_cart_enabled', '__return_false' );
Source: https://github.com/woocommerce/woocommerce/pull/19027
Finally got everything working. Doing so required following https://jhtechservices.com/woocommerce-persistent-cart-issue/ and then clearing the cookies and cache everywhere. Hopefully this'll help someone else!
You can just override the user meta value with a filter - much better than deleting the value every time.
function disable_persistent_cart( $null, $object_id, $meta_key, $single ) {
if ( '_woocommerce_persistent_cart_' . get_current_blog_id() == $meta_key ) {
if (get_current_user_id() === $the_user_id)
return '';
}
return $null;
}
add_filter( 'get_user_metadata', 'disable_persistent_cart', 10, 4 );
Any way to disable or remove wordpress post via email?
I tried adding the following code in functions.php, but I still see 'Post via email' under Settings > Writing:
apply_filters( 'enable_post_by_email_configuration', false );
Thanks
I found this code
add_filter( 'enable_post_by_email_configuration', '__return_false', 100 );
from code.tutsplus.com
It does remove the section from the WordPress admin. I'm assuming it disables the 'Post via email' function entirely.
Can anyone confirm?
Yes it worked for me
add_filter( 'enable_post_by_email_configuration', '__return_false' );
This was removed from wordpress in version 3.7.
If you still see it in the user profile screen then it is likely added by jetpack.
Our free plugin Disable Post Via Email disables both the Post Via Email functionality and the associated UI options, using a similar filter as previously shared:
add_filter('enable_post_by_email_configuration', '__return_false', PHP_INT_MAX);
I'm trying to get Wordpress to re-direct to a specific page after someone registers but not having much luck.
On other suggestions I have tried adding this to the functions.php file:
function __my_registration_redirect()
{
return home_url( '/page' );
}
add_filter( 'registration_redirect', '__my_registration_redirect' );
This did not work.
People also suggest using Peter's Login Redirect plugin, but it hasn't been updated in years and I can't get it to work.
Any advice would be appreciated.
Do you have any headers problems, if you did not know turn on the debug log in wp-config
define( 'WP_DEBUG_LOG', true );
then try your code again and check the error log on wp-content/debug.log
I'm running into a Major trouble.
Today I found out that when visiting a specific URL on my website, the admin toolbar shows up. Also for people who are not logged in. It appears that the visitor is logged in, but that's not true. All the links in the toolbar go to a 404 page. However, important information is being shown, like how many plugins need an update and even my login name.
Is anyone familiar with this?
Since it is a corporate website, I need a fix as soon as possible.
(due to security reasons I won't post the exact url in public)
Hopefully anyone can help me.
Thanks,
Stefan
Try to add either of these code in functions.php of your theme,
Code 1:
<?php
add_filter('show_admin_bar', '__return_false');
?>
Code 2:
function hide_admin_bar_from_front_end(){
remove_action( 'wp_head', '_admin_bar_bump_cb' );
return false;
}
add_filter( 'show_admin_bar', 'hide_admin_bar_from_front_end' );