Meta Box
Support › Meta Box AIO › Get custom field value
Hey there,
Can you please tell me how to get a custom field value using get_post_meta()?
For a custom field of 'filledexpired' I tried: get_post_meta($post->ID, 'filledexpired', true);
get_post_meta($post->ID, 'filledexpired', true);
But it doesn't seem to be working.
rwmb_meta('filledexpired', get_the_ID());
Works, but I'd like to use the native wordpress function in case later I uninstall the metabox plugin.
Thanks, Fergal
Hi,
This code is correct to get the custom field value with the WordPress function
get_post_meta( $post->ID, 'filledexpired', true );
You can change the variable post ID to a specific post ID like get_post_meta( 123, 'filledexpired', true ); and recheck this issue.
get_post_meta( 123, 'filledexpired', true );
Read more on the documentation https://developer.wordpress.org/reference/functions/get_post_meta/