crowdfavorite / wp-post-formats

An admin interface and structured post meta for WordPress post formats.
362 stars 78 forks source link

Fixes "creating default object from empty value" warning. #45

Closed QWp6t closed 3 months ago

QWp6t commented 10 years ago

Resolves the following PHP warning message:

Warning: Creating default object from empty value

This warning was caused because $post had not been set, i.e., it was null.

If we don't like get_post($post_id), then the following workaround would also get rid of the warning:

$post = is_object($post)?$post:new stdClass();
$post->ID = $post_id;

You would insert that near L199.