When I am inserting a new article there is an error -

Notice: Undefined property: stdClass::$field_tags in hook_node_presave() (line 344 of D:\wamp\www...)

The code for line 344 is-

function mltag_node_presave($node) {
$count = count($node->field_tags[$node->language]); //line 344

This error only shows up when adding a new article, and not when editing an article. The line 344 is just to count the number of term-ids in the textfield for tags. Any suggestions ??

EDIT - field_tags is the name of the default Tag textfield added in the add-article page

1 Answer 1


I think you need to do an isset($node->field_tags[$node->language]), if it is empty $node->field_tags[$node->language] will not exist. Could you check if it is only articles with the empty field_tags that are affected?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.