within my functions.php I include this MailChimp API wrapper to use it later on if somebody clicks a checkbox and submits a comment.
https://github.com/lornajane/mailchimp-api/blob/master/MailChimp.class.php
My server logs show that the Mailchimp.php calls himself everytime a user visits the page.
The IP is my server's ip:
176.28.32.232 - - [06/Aug/2015:00:00:31 +0200] "GET /wp-content/themes/gettheme/inc/MailChimp.php HTTP/1.0" 200 0 "-" "-" "myhost.com"
How can I stop this? Do I need to include the file only if someone presses the button or is this an issue in the mail chimp api wrapper file?
My functions.php looks like this:
<?php
include_once( get_stylesheet_directory_uri() . '/inc/MailChimp.php' );
add_action('comment_post', 'custom_add_meta_settings');
function custom_add_meta_settings( $comment_id, $comment_approved ) {
//some code goes here
if ( $subscribe == 'on' ) {
//use Mailchimp API
$MailChimp = new MailChimp('//mylistid');
I could now move the include_once statement direct after the function opens, but will this fix my issue?
Thanks.