MainWP code snippets - add_filter needs to be added to the end of wp-config.php

Take for example this code snippet: https://github.com/mainwp/Code-Snippets-Functions/blob/master/Add%20functions%20to%20the%20wp-config.php%20file/disable-automatic-core-updates-emails.txt

It will work manually if placed after:

/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';

… in your wp-config.php file. However, MainWP Code Snippets extension places add_filter snippets in the same place as define snippets.

Any suggestions/workarounds or fixes?

Hi @xyzulu

Thanks for reporting this.

That snippet was mistakenly placed in the “Add functions to the wp-config.php file”. We will have that fixed.

All add_filter or add_action should be Executed on Child sites, and not saved to wp-config.php.

Thanks… will you get github fixed up? There are a few other snippets also listed a wp-config.php that are add_filter or add_action ones.

You are most welcome.

Yes, we will place the snippets in the appropriate directories in GitHub.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.