Support

Account

Home Forums Bug Reports [5.0.x] Most pages don't show up when adding a rule to target a specific page Reply To: [5.0.x] Most pages don't show up when adding a rule to target a specific page

  • Okay, figured it out.

    The error is in acf_get_posts() and the $offset variable:

    
    $offset = 0;
    
    // ...			
    
    // loop over posts and find $i
    
    foreach( $all_posts as $offset => $p ) {
    	if( $p->ID == $match_id ) {
    		break;
    	}				
    }
    			
    // order posts
    $all_posts = get_page_children( 0, $all_posts );
    			
    for( $i = $offset; $i < ($offset + $length); $i++ ) {
    

    $offset is used in the foreach loop, which then breaks it when trying to do the for loop at the end. Changing $offset => $p to $postOffset => $p, or even just => $p, solves the issue.