I have the following code:

$fieldHandle = 'contentLead';

$entryTitle = $event->element;
$entryQuery = \craft\elements\Entry::find();

$entries = $entryQuery->title($entryTitle)->limit(1);

foreach ($entries->all() as $entry) {
    $entry->setFieldValue($fieldHandle, 'hello');

    Craft::$app->elements->saveElement($entry, false, true);
  • After saving the element, does $entry->getErrors() return anything? – Brad Bell May 14 '19 at 3:47
  • Sorry for disappearing, I worked around this issue (forked the Guest Entries plugin). Using the code above in a different case worked perfectly, thanks! – Ottó Radics Sep 7 '19 at 22:10

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.