Website malfunction after the use of Pods plugin
Pods is a content development framework for WordPress that you can use to create, manage and implement custom content – all in one place. It allows you both to create completely new material and to further customize the content that already exists. With an average rating of 4.9/5, it has become the favorite plugin for many creators.
Despite the positive reviews of Pods, you may still encounter a problem with page listings. If you do, don’t worry – we have a solution for you.
After routine WordPress plugin updates, we’ve noticed that some subpages are broken. HTTP response status code was still correct (200), but listing suddenly stopped rendering. A close look at source-view HTML showed:
(...) <article id="post-393" class="post-393 page type-page status-publish hentry"> <div class="entry-content"> <div class="list-item-element"> <div class="list-item-wrapper"> <a class="list-thumbnail" href="/news/title-123/"> <img src="/wp-content/uploads/2019/03/logo.jpg" /> <h4 class="list-title">Title 123</h4> </a> </div> </div> (...) END of output
We enabled WP-DEBUG Log to check if there are any PHP errors. We added the following solution to wp-conifg.php :
// define('WP_DEBUG', false); define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', 'wp-content/ct_debugging.log'); define( 'WP_DEBUG_DISPLAY', false );
However, the error log didn’t show any critical errors. We had to conduct a more in-depth investigation: listings are rendered by wordpress plugin: Pods – Custom Content Types and Fields 2.7.21.
In Wp-admin / Pods Admin / Pod Templates / news-root there was the following template:
[before] <div class="main-list"> [/before] <div class="list-item-element"> <div class="list-item-wrapper"> <a class="list-thumbnail" href="{@permalink}"> <img src="{@post_thumbnail_url.full}" /> <h4 class="list-title">{@post_title}</h4> </a> </div> </div> [after] </div> [/after]
The bug was caused by {@post_thumbnail_url.full} in a situation when the “featured image” wasn’t added to the news. In the previous plugin version, it was working totally fine.
Solution
We introduced special tags into the template: [if post_thumbnail][/if]
After adding those, the page started to work correctly again.
[before] <div class="main-list"> [/before] <div class="list-item-element"> <div class="list-item-wrapper"> <a class="list-thumbnail" href="{@permalink}"> [if post_thumbnail] <img src="{@post_thumbnail_url.full}" /> [/if] <h4 class="list-title">{@post_title}</h4> </a> </div> </div> [after] </div> [/after]
Update
Some time later, the bug was fixed in the next plugin release (2.7.22). More info here: https://github.com/pods-framework/pods/pull/5805
= 2.7.22 – August 13th 2020 =
**Bug Fixes**
* Fixed: Prevent fatal errors about memory when using certain magic tag / thumbnail combinations. #5805 (@JoryHogeveen)