Programmatic SEO page field
3 min read
The Programmatic SEO page field lets an editor pick one page that a Programmatic SEO (pSEO) task generated and print it as a link. Use it to connect a hand-written post, for example a guide, to the generated page about the same city or product.
Type id |
|
Builder category | Relational |
Column |
|
Returns | the page id as a number, or |
Prints | a link whose text is the page title |
Needs | Pro, Business or Agency plan (the Programmatic SEO feature) |
Add the field
- Edit a field group and add a field of type Programmatic SEO page.
- Under Programmatic SEO task, choose the task whose pages editors may pick. The help text reads: "Editors can only pick pages this task generated." The list shows your task names and the first task is preselected.
- Save the group.
One field is bound to one task. This keeps the search fast even when a task generated many thousands of pages. Use several fields for several tasks.
If no task is chosen the group still saves, but on the edit screen the field shows "Choose a Programmatic SEO task in this field's settings before editors can pick a page." and nothing can be picked. A task you delete later leaves the field without pages to pick.
The field is not available inside a Group or Repeater, and it is not shown in front-end forms (the picker uses the admin).
Edit screen
The picker searches the chosen task's active pages by title or URL while you type, 20 results at a time. Each result shows the page title and, as extra text, its path. Only one page can be chosen; picking another replaces it. Editors need the edit_posts capability to search.
What is saved
- The page id, only when the page belongs to the field's task. A page of another task, or an id that does not exist, is stored as empty.
- Clearing the picker clears the field.
From code:
wpmcf_update_field( 'city_guide', 'generated_page', 602, $post_id );You can see the pages a task generated under WPM Fields › Programmatic SEO. The feature that generates the pages is described in Programmatic SEO overview and concepts. The same field is also described from the Programmatic SEO side in The Programmatic SEO page field.
A CSV import that fills field values accepts either a page id or the page's exact title (not case sensitive); both must belong to the field's task and be active.
Reading
$page_id = wpmcf_get_field( 'city_guide', 'generated_page' );
// 602 (or null)wpmcf_get_field() returns the stored id even if the page was disabled or removed later.
Printed output, for an active page:
<a href="https://example.com/cities/izmir/">Izmir city guide</a>- A page without a title is shown with its path as the link text.
- If the page is not active any more (disabled, removed, moved, shadowed by real content or converted into a post), nothing is printed. The same happens if the id no longer exists.
[wpmcf_field group="city_guide" field="generated_page" wrap="false"]Good to know
- Deleting a task deletes its generated pages, so fields that pointed at them print nothing afterwards.
- A page converted to a post is no longer a generated page, so the field prints nothing for it. Use a Post object field for the real post after converting.
Without a license
Values stay. The field is shown as locked on the edit screen. Generated pages themselves follow the Programmatic SEO expiry policy (served for a grace period, then 404 unless converted), so a printed link can lead to a page that no longer loads. See License expiry.
Troubleshooting
- The picker says to choose a task. Open the field group and set Programmatic SEO task.
- I cannot find a page. Only active pages of the field's task are listed. Check the page's status on the task's generated pages.
- My saved page vanished. The page belongs to a different task than the field's current task, or it was deleted. Pick it again.
- Nothing prints on the site. The page is not active, or it was deleted.
Still stuck? Contact support