Support » Plugin: WordPress Meta Keywords » PHP notice messages

  • I’m seeing this PHP notice message on every page when WP_DEBUG is enabled:

    Notice: Undefined variable: keywords in C:\[path-here]\plugins\wordpress-meta-keywords\wordpress-meta-keywords.php on line 50

    Affected code:

    if ( !empty($tags) ) {
    			foreach ($tags as $tag) {
    				$keywords[count($keywords)] = $tag->name;
    			}
    			echo '<meta name="keywords" content="'.implode(", ", $keywords).'" />'."\n";
    		}

    Suggested fix: Initialize the $keywords variable.

    if ( !empty($tags) ) {
    			$keywords=array();
    			foreach ($tags as $tag) {
    				$keywords[count($keywords)] = $tag->name;
    			}
    			echo '<meta name="keywords" content="'.implode(", ", $keywords).'" />'."\n";
    		}

    http://wordpress.org/plugins/wordpress-meta-keywords/

  • The topic ‘PHP notice messages’ is closed to new replies.