1

I'm currently using wp_list_pages to show site pages.

It doesn't include private pages, so I need to find a way to produce a list of them too.

I can do it with a plugin, but it includes various options I don't need and I prefer to hardcode something appropriate into a template.

2
  • Not enough information provided, add your code that your using.
    – Malisa
    Sep 13, 2016 at 8:09
  • @Malisa... Thanks. I hadn't seen your reply when I answered the post below.
    – gulliver
    Sep 14, 2016 at 5:28

2 Answers 2

1

You can just add a post_status argument:

wp_list_pages( array(
    'post_status' => array( 'publish', 'private' ),
));
0
1

This issue has been tracking since eight years ago, and it's not fixed yet (see https://core.trac.wordpress.org/ticket/8592)

Maybe you should replace wp_list_pages() with get_pages() and some php to generate your list due get_pages() allows you to find private pages too (see https://codex.wordpress.org/Function_Reference/get_pages)

3
  • Thanks. I'd tried the default example from that codex page, and was getting no info displayed.
    – gulliver
    Sep 13, 2016 at 10:04
  • And that's a normal behavior: array get_pages($args), it returns an Array of posts objects. You should iterate it with some foreach bucle and extract desired fields to compose your html Sep 13, 2016 at 11:17
  • 1
    Thanks for the suggestion. Currently though, that's beyond my knowledge - but I'll add it to my list of things to learn.
    – gulliver
    Sep 14, 2016 at 5:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.