How to check for a custom field?
-
I am new to wordpress, so I have the following question, regarding if this is the right way to do this. It seems to work in my context, but I am curious, if there are better ways to do this?
I am using wordpress as a cms and have a section of portfolio pages. Some of them have urls to projects and some don’t have that. So I have the following to check if that custom field is there:
if ( get_post_meta($post->ID, 'project_url', true) != "" ) { // Add link here };
Is this how I would do this?
Thanks a lot for any advice on this!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘How to check for a custom field?’ is closed to new replies.