• Probably a minor issue:
    PHP Notice: Undefined index: o:tag in *private*/wp-content/plugins/mailgun/includes/wp-mail.php on line 154

    – WordPress Multisite
    – PHP 7.0.2

Viewing 4 replies - 1 through 4 (of 4 total)
  • anonymized-11892634

    (@anonymized-11892634)

    Same problem for me, but on a single WP site on PHP 5.6

    anonymized-11892634

    (@anonymized-11892634)

    Fixed this by changing line 154 to:

    if (empty($body['o:tag'])) {

    Not sure if that breaks any functionality, but it seems to be working for me

    anonymized-11892634

    (@anonymized-11892634)

    Scratch that, I think that may have broke sending

    Hi everyone.

    I am no PHP expert, but it appears on line 154 when $body[‘o:tag’] is referenced, $body[‘o:tag’] is in fact undefined. Which is why what Phil said ‘worked’. However, preventing that entire body from executing could cause problems. A better workaround, I think, would be to provide the default option that line 154 wants, which is when $body[‘o:tag’] is equal to ” rather than being undefined.

    In short, go to lines 146-149 and change

    if ( isset( $mailgun['tag'] ) ){
    		$tags = explode(",", str_replace(" ","", $mailgun['tag']));
    		$body['o:tag'] = $tags;
    	}

    to

    if ( isset( $mailgun['tag'] ) ){
    		$tags = explode(",", str_replace(" ","", $mailgun['tag']));
    		$body['o:tag'] = $tags;
    	} else {
    		$body['o:tag'] = '';
    	}

    This makes sure that $body[‘o:tag’] always has a value and will not be undefined when it is referenced. Hopefully this helps!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘PHP Notice: Undefined index: o:tag’ is closed to new replies.