Jump to content

Getting data from a hidden/unpublished page


Manaus
 Share

Recommended Posts

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

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 by cwsoft
Link to comment
Share on other sites

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

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");

 

  • Like 1
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...