Viewing 4 replies - 1 through 4 (of 4 total)
  • Oh, and before anyone asks: “why don’t you just use get_posts()?” let me say that it’s because of the fact that get_posts returns private posts when logged in while get_pages supposedly does not. I’m aiming for public posts only.

    if there’s still a need

    use smth like this:

    function add_hierarchy_to_post() {
           global $wp_post_types;
    	$post = $wp_post_types['post'];
    	return $post->hierarchical = true;
    } add_action('init', 'add_hierarchy_to_post');

    as the get_pages() runs post_type against is_post_type_hierarchical() and if the given post type fails to be hierarchical it returns pages whatever the args are.

    Hi indybook, that’s brilliant! I had not noticed this particular check… I’ll have to test this ??

    Yeah, would be less confusing if it was mentioned at the codex

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘get_pages post_type parameter not working’ is closed to new replies.