• Baden

    (@baden03)


    When the [gallery] shortcode is called outside of the loop, a php notice is thrown because $post->ID is not defined. There should be a check in wp-includes/media.php on line 699 if the $post-ID is defined. In the meantime, this was solved by checking and if empty assigning a value like so:

    if(empty($post->ID)){
    	$post->ID = 0;
    }

    and presto! the notice goes away.

  • The topic ‘PHP Notice when calling Gallery Shortcode Outside of Loop’ is closed to new replies.