offset 0 not found — $attachment
-
Thanks for the very useful plugin, and thanks for making your code easy to read and modify.
A funny thing happened when I viewed a media page in theme twentythirteen.
In get_attachment_id_by_url, apparently $attachment was returned as an empty array.
To fix this, I merely replaced
if ( ! is_array($attachment)
with
if ( (! is_array($attachment) )||(! isset($attachment[0])) )
And all is well again. The pdf file is embedded in the media page.
I am not sure why auto-embedding worked fine elsewhere, but not on the media page.
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘offset 0 not found — $attachment’ is closed to new replies.