Forums

[resolved] get_pages() to get post type gives Notice on line 3347 at wp-includes/post.php (1 post)

  1. Ervald
    Member
    Posted 7 months ago #

    Hi,

    This is my code:

    <?php
    	$mypages = get_pages( array( 'post_type' => 'intro') );
    
    	foreach( $mypages as $page ) {
    
                   echo $page->post_title;
    
    	 }
    ?>

    I'm able to get the intro pages when using this code on the twenty_eleven theme, for some reason though, I get nothing when using it on my own theme.

    Comes with this notice:

    Notice: Only variable references should be returned by reference in *****\site\wp-includes\post.php</b> on line 3347</b>

    It does work by changing it to get_posts(); but it's not what I want.

    I used to have no problem using get_pages() for custom post types in the past and I'm wondering what causes the error.

    Thanks in advance.

Reply

You must log in to post.

About this Topic