Get custom field value

Support Meta Box AIO Get custom field value

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #38294
    FergalFergal
    Participant

    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);

    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

    #38301
    Long NguyenLong Nguyen
    Moderator

    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.

    Read more on the documentation https://developer.wordpress.org/reference/functions/get_post_meta/

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.