Update to Codex loop page (2 posts)

  1. wmmead
    Posted 5 years ago #

    Hello, I have an update to the codex page on the loop. I am not sure I am putting this comment in the correct location. Please let me know if I should be putting it elsewhere.

    I have multiple loops running on a magazine style site and do not want duplicate posts from one column to the next. I followed the procedure found on the codex, which was working, but I was getting an error in my error log telling me that the data type for the second argument in the is_array() function was not the correct type.

    Upon looking up the function on the PHP.net site, I modified the use of the function in the loop like this:

    if ( in_array( $post->ID, $do_not_duplicate, true ) ) continue;?>

    I added the word "true". This keeps the errors from being generated in the error log. I think this is fairly new to PHP and should, I am guessing be added to the codex page. The code was working without it, but it was generating the error. I don't think a lot of people check their error log file so they probably have no idea.

    I hope this helps someone, and let me know if I should be posting this info somewhere else.

  2. Rev. Voodoo
    Posted 5 years ago #

    well, if you have an edit for the codex, you should be posting it there! The codex is community driven

Topic Closed

This topic has been closed to new replies.

About this Topic