PHP Warning: Illegal string offiset ‘ID’
-
Hi,
We have a custom post type set up with PODS, which is displayed on the frontend of the website. There are two file upload fields in the CPT, one for an image and one for a PDF file.
Sometime during October and now, when we create a new post for this CPT, we get the following warning on the front end: Warning: Illegal string offset ‘ID’ in …..
The PDF and image can be added to the the upload fields in wp-admin, but when we click on “Publish” the values are removed from the upload fields and we get the above warning for the new post on the frontend, instead of the image or PDF link. All previous posts from the last four years, and are still displaying as expected.
I turned display_errors to ‘Off’ in wp-config.php and now new posts will save and display correctly. I wonder if turning the error messages off is just a bandage and that something else needs to be fixed.
This is the code being used to display the CPT:
while ( $newsletters->have_posts() ) : $newsletters->the_post(); $cover = get_post_meta( get_the_ID(), 'cover_photo', true ); $pdf = get_post_meta( get_the_ID(), 'pdf_file', true ); ?> <div> <h5> <?php the_date( 'F Y' ) ?> </h5> <a href="<?php echo $pdf[ 'guid' ] ?>" target="_blank" title="<?php the_title() ?>" class="newsletter"><?php echo wp_get_attachment_image( $cover[ 'ID' ], 'newsletter-cover-thumb' ); ?></a>
Any ideas are appreciated.
Thank you!
- The topic ‘PHP Warning: Illegal string offiset ‘ID’’ is closed to new replies.