The get_page() function excludes private pages
-
Hello,
you use the
get_pages()
function to populate the list of pages to redirect to, after verification.
However, this function by default lists only “published” pages, but not “private” ones.This is counter-intuitive in this context since, once a user has registered and has logged in, you might want to show them a private page that they couldn’t access previously.
I would recommend adding arguments to your
get_pages()
, like so:$args = array( 'sort_order' => 'asc', 'sort_column' => 'post_title', 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '', 'authors' => '', 'child_of' => 0, 'parent' => -1, 'exclude_tree' => '', 'number' => '', 'offset' => 0, 'post_type' => 'page', 'post_status' => 'publish,private' ); foreach( get_pages($args) as $page )
The last argument in the array allows for private pages to be listed. All the other arguments displayed here are the default ones.
I’ve tested the above in your plugin and it works.
- The topic ‘The get_page() function excludes private pages’ is closed to new replies.