Disabling Comment Notifications for Post Author

I skimmed through the source of the wp_notify_postauthor() function and noticed the comment_notification_recipients filter. I wonder if you could simplify your plugin to the following code snippet: <?php /** * Plugin Name: Disable comment/trackback/pingback notifications emails * Plugin URI: http://wordpress.stackexchange.com/a/150141/26350 */ add_filter( ‘comment_notification_recipients’, ‘__return_empty_array’, PHP_INT_MAX ); add_filter( ‘comment_moderation_recipients’, ‘__return_empty_array’, PHP_INT_MAX ); where we use an … Read more

How does WordPress Multisite know that a Plugin is installed?

You can clearly see the way WordPress loads plugins if you inspect the source code of the file wp-settings.php. The function wp_get_active_and_valid_plugins() loads plugins for individual sites in the network and for non-Multi-Site installations, while wp_get_active_network_plugins() loads network activated plugins when Multi-Site is enabled. The former more or less just calls get_option() to get the … Read more

WooCommerce – Load Templates From Plugin For All Template Files

WooCommerce uses the template_include filter/hook to load main templates like archive-product.php and single-product.php. And here’s the class which handles main templates. And there’s a filter in that class which you can use to capture the default file (name) which WooCommerce loads based on the current request/page — e.g. single-product.php for single product pages. You can’t, … Read more

Multiple plugins vs combined one

If it’s exactly the same code, then no – it shouldn’t cause any performance changes… Why? Because loading a plugin is pretty easy (hence quick) process. It all happens in wp-settings.php and this is the code: // Load active plugins. foreach ( wp_get_active_and_valid_plugins() as $plugin ) { wp_register_plugin_realpath( $plugin ); include_once( $plugin ); } unset( … Read more

Is there a hook attached to general settings save?

You just need to register_setting() on your setting and it will be saved automatically. See the Settings API for more info. Here’s a complete example: function spw_cb() { if( !($value = get_option(‘sprockets_per_widget’)) ) { $value = 7; } ?> <input type=”text” size=”3″ name=”sprockets_per_widget” value=”<?php echo $value; ?>” /> Numeric only! <?php } function spw_init() { … Read more

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