Jump to content

How to get a Page field's ID only


Jonathan Lahijani
 Share

Recommended Posts

I have a Page field and in ProcessWire, I can get values from it like this:

$page->my_page_field; // returns the ID
$page->my_page_field->title; // return the title

Given my particular situation, I'm hitting an infinite loop as I documented here a few years ago:
https://github.com/ryancramerdesign/ProcessWire/issues/1962

Is there a way to ONLY get the raw ID of the assigned page without ProcessWire getting all the attributes of that page leading to the loop?

Link to comment
Share on other sites

On 9/22/2019 at 1:13 AM, Jonathan Lahijani said:

I see that if I enable auto-join for the field, then it circumvents the issue.  So that's one solution.

That sounds like a good solution. Are you not happy with it?

RockFinder2 might be overkill here, but if you have it available it might be an option:

Z5nARIR.png

"owner" is a regular single page field. Or if you need multi-page-values:

rGy5ZeL.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...