Any changes between WP 4.9 and WP 5.6 that might cause a problem here?
-
Hello, I have an old custom wordpress (always an old custom site with me lol, they find me!) site that was working fine running PHP 7.3.9 and WP 4.9.18 and I have since upgraded to PHP 7.4.21 and WP 5.6.10 in an effort to push to WP 6 and hit a snag along the way. There were some custom archive links by year used to access older custom field data that are no longer doing anything other than reloading the same page, whereas previously they would link to the page with the years list of stuff. I was wondering if someone notices anything with this block of code? I added a few comments of some errors WP was logging but they seem fairly inconsequential, but might be useful. I don’t know. Any thoughts very much appreciated thanks!
<!-- Was working PHP 7.3.9, WP 4.9.18 Not working PHP 7.4.21, WP 5.6.10 --> <div> <h3>Newsletter</h3> <ul> <?php $urlSplits = explode('/', $_SERVER['REQUEST_URI']); ?> <?php $counter = 0; ?> <?php while(the_repeater_field('external-links')): $tempDate = explode(',', get_sub_field('date')); $mediaYears[] = $tempDate['1']; // *** Notice: Undefined offset: 1 $data[$counter]['year'] = $tempDate['1']; // *** Notice: Undefined offset: 1 $data[$counter]['date'] = get_sub_field('date'); $data[$counter]['link'] = get_sub_field('link'); $data[$counter]['title'] = get_sub_field('title'); $counter++; endwhile; ?> <?php $keys = 0; $mediaYears = array_unique($mediaYears); foreach ($mediaYears as $value) { if ($value != '') { $uniqueYears[$keys] = $value; $keys++; } } rsort($uniqueYears); $data = array_reverse($data, true); if ($urlSplits[3] != '') { $currentYear = str_replace(' ', '', $urlSplits[3]); } else { $currentYear = str_replace(' ', '', $uniqueYears[0]); } ?> <?php for($i = count($data); $i >= 0; $i--) { ?> <?php if ($currentYear == $data[$i]['year']) { // *** Notice: Undefined offset: 135 // *** Notice: Trying to access array offset on value of type null ?> <li> <em><?php echo $data[$i]['date'] ?></em> <strong><a href="<?php echo $data[$i]['link'] ?>" rel="bookmark"><?php echo $data[$i]['title'] ?></a></strong> </li> <?php } ?> <?php } ?> </ul> <?php for ($i = 0; $i < count($uniqueYears); $i++) { ?> <!-- THIS IS THE LINE THAT CREATES THE YEAR LINKS TO GO TO ARCHIVE PAGES --> <a href="https://www.domain.org/news/newsletter/<?php echo str_replace(' ', '', $uniqueYears[$i]); ?>"><?php echo $uniqueYears[$i]; ?></a> <!-- Permalink set to Custom Structure: /news/%category%/%year%/%monthnum%/%postname%/ (Not sure if this is relevant) --> <?php } ?> </div>
- The topic ‘Any changes between WP 4.9 and WP 5.6 that might cause a problem here?’ is closed to new replies.