I'm cloned an existing D7 site onto a new computer that I've worked on many times before, but I have a problem I've never seen before - I can't print ANY field using entity_metadata_wrapper.
The fields exist in the backend and the backend works fine.
Printing $wrap->raw() shows all the fields as expected but $wrap->field->value() doesn't.

Our templates use this heavily, and as the site is live there is nothing wrong with the code, but my environment.
But what could it be? I've tried all types of PHP version (on MAMP) to avail.

Any help appreciated!

<?php $wrap = entity_metadata_wrapper('node', 123) ?>
<?php print $wrap->field_any_field->value(); ?>

EntityMetadataWrapperException: Unknown data property field_any_field. in EntityStructureWrapper->getPropertyInfo() (line 354 of

  • you sure you got the correct nid and that that field machine name belongs to the nid? – No Sssweat Oct 3 '19 at 15:59
  • try $wrap->title->value(); does it work? – No Sssweat Oct 3 '19 at 16:01
  • $wrap->raw()->title works, $wrap->title->value() doesn't work: Unknown data property title. Something is seriously screwed here! – Chris Oct 4 '19 at 5:34
  • I suggest exporting from live site and importing the DB to your local again, maybe something went wrong with your original import. – No Sssweat Oct 4 '19 at 5:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.