I feel like I’m missing something really basic here:
– I have a “Hero” group that I’ve added to the homepage field set as a clone
– I’ve now cloned the same group to my general Page fieldset, so I can use it on all pages.
– Now, pages (there are a lot of them!) are consistently throwing the following error:
Warning: Trying to access array offset on value of type null in /Users/dafydd/Local Sites/cymdeithas-madog/app/public/wp-content/themes/cm24/cm24_inc/hero.php on line 3
– I know this is because the hero field hasn’t been added to these pages’ database entries.
– I can resolve this issue by entering the edit interface for each page and hitting Update, which adds the Hero entry to the page’s database entry. Bulk editing doesn’t work.
I’m using the following to get the Hero group:
$hero = get_field(‘hero’)[“hero”];
My questions:
1. Is there a way to update all pages at once to register the new field?
2. Barring that, is there a way to allow get_field() to fail without throwing an error?
Grateful for any advice here!