How to save "exclude from nav" with php
Permalink
I have pages that are being generated via a single page administration in the dashboard.
I would like to have each page be saved as "exclude from nav" so it doesn't get added to the navigation (for this particular sort of page).
If $p is my page, can I just do:
Or is there a step I am missing in order to add this particular attribute to the page? Or several steps?
I would like to have each page be saved as "exclude from nav" so it doesn't get added to the navigation (for this particular sort of page).
If $p is my page, can I just do:
$nav = CollectionAttributeKey::getByHandle('exclude_nav'); $nav->saveAttributeForm($p);
Or is there a step I am missing in order to add this particular attribute to the page? Or several steps?