• Resolved kanika

    (@kanikawordpresscom)


    I wanted to check if a meta key exists for a post id.

    I used,

    foreach( $inspirations as $inspiration ){
    		$photoVar = get_post_meta($inspiration->ID,'photo', true);
    		if ($photoVar != '')
    		{//code here
    }

    Doesnt seem to be working.

    Please help.

Viewing 1 replies (of 1 total)
  • Thread Starter kanika

    (@kanikawordpresscom)

    Hey Thanks,

    Its done.

    I used,

    foreach( $inspirations as $inspiration ){
    		$photoVar = get_post_meta($inspiration->ID,'photo');
    		if (! empty( $photoVar ))

    Guess it was a php question, not a wordpress problem.

    Thanks,
    Kanika.

Viewing 1 replies (of 1 total)
  • The topic ‘Check if key for post_meta for a post exists’ is closed to new replies.