Manaus Posted October 8 Share Posted October 8 On page A I'm trying to get some fields data from page B, which I need to be hidden/undiscoverable. I'm using `$pages->get` method, but as soon as I make page B hidden/unpub, page A returns error. How can I workaround this? Thanks! Link to comment Share on other sites More sharing options...
cwsoft Posted October 8 Share Posted October 8 (edited) Hi. Have you tried to add include=all or include=hidden as parameter or via the options array to the get or find API calls? See API overview for details: https://processwire.com/api/ref/pages/find/ From the API doc page: include (string): Optional inclusion mode of 'hidden', 'unpublished' or 'all'. (default=none). Typically you would specify this directly in the selector string, so the option is mainly useful if your first argument is not a string. Cheers cwsoft Edited October 8 by cwsoft Link to comment Share on other sites More sharing options...
Sanyaissues Posted October 8 Share Posted October 8 pages(1040)->title; $pages->get(1040)->title; $pages->findOne("id=1040, include=hidden")->title(); Here's an example dumping the title property and the status of my Demo, hidden page. Link to comment Share on other sites More sharing options...
Manaus Posted October 8 Author Share Posted October 8 I read on the documentation about `find`: Quote This is functionally similar to the get() method except that its default behavior is to filter for access control and hidden/unpublished/etc. states So `get` should fetch also unpublished pages. Still not working... I'm using it through the `child` method, I guess `child` inherits `get` functionalities right? Link to comment Share on other sites More sharing options...
Sanyaissues Posted October 8 Share Posted October 8 being 1033 the page with the children you want to get: //Given than child only returns a single page, you can use sort,to for example get the newest child of 1033. $pages->get(1033)->child("sort=-created, include=hidden"); 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now