There is no $post
var local to your function, you need to use global $post
first, or get_the_ID()
.
get_post_meta( get_the_ID(), '_cf_address', true );
Related Posts:
- Create a random unique 6 digit number as custom field for custom post type
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- what is the correct way to compare dates in a WP query_posts meta_query
- Advanced search form with filters for custom taxonomies and custom fields
- Custom field values deleted when trashing custom post type
- How to get all custom fields of any post type
- Admin Area Custom Type Search By Meta Fields Without Title & Content
- How Can I save multiple records in same meta key?
- Detect meta value changes when post is updated (post_updated)
- Search everything (posts, pages, tags, cpt, meta)
- Grossly inefficient wordpress loops!
- How to solve suspected memory issue in custom WordPress loop?
- WP_Query on custom post type not displaying, multiple loops & get_template_part
- Using new WP_Query in shortcode in a custom field causes the main post content to not display
- How to get source of custom meta image?
- Displaying Meta Box Image
- Get_post_meta() won’t return value
- ACF Upload Image in repeater from front-end with custom form? – add_post_meta()
- Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
- Displaying custom posts only if custom meta box’s date is not expired
- Display custom post on home page based on a metabox selection
- get_template_part() – post-meta not working?
- wp_query to find posts by year and month
- how to interconnect custom post types?
- How to insert content from another Custom Post type into Post?
- List all images from a single post meta value
- Populate Custom Fields in a Custom Post Type?
- WP_Query orderby modified to include custom meta changes
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- Calculate all custom field values in the post loop
- How to check if user meta field is empty in conditional else statement
- What is the recommended / best way to do this: Event calendar post/type in a block-based theme?
- Posting to a Custom Post Type from front end – user generated content
- A better way to add a meta box to custom post types
- Two Custom Post Types Many to Many Relationship
- get_post_meta not working on publishing
- Store CPT ‘Reviews’ average ratings to a WordPress DB table or to a DB custom table?
- How do I set all of a particular post meta to a value within the custom post type I’m in?
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- Importing Data from a Non-WordPress database, into WP
- Custom fields for custom post type
- Check if post with same meta value exists
- Submitting Custom Post Types with custom fields from Front-end form
- create custom meta box with default value
- Create Array from custom post type to display a slider
- How to get specific post meta by title or id
- How to conditionally add Custom Post Type to Front Page
- Having Issue on Ordering CPT by Custom Field In Custom WP Query
- Get data from PHP to JavaScript to set position of each post on front page
- copy images from custom field to another custom field
- How to show custom field on specific custom post type posts only when filled
- Get post content from another section in custom single page
- Cannot obtain custom meta information
- How can I output WPAlchemy repeating fields meta values in my page template?
- How to call a post’s metadata in shortcode.php?
- How to retrive Custom Post Type Meta Fields in Custom WP_Query
- delete duplicate meta_value with same post_id
- Search CPT Title AND Meta
- updating one custom meta field only
- Get post-meta value of all custom-posts – lowest to highest year-count?
- Empty meta-box returns publishdate if no value is set?
- Custom PT, Taxonomys and wordpress query
- Displaying Posts Using a Custom Query with a Custom Field and a term_id
- How can i loop through custom post type according to custom meta field?
- Filter search posts by post meta?
- How to sort WP_Query by a custom text field (written as a date dd/mm/yyyy)
- Custom Post Type meta data getting deleted on bulk editing taxonomies
- Unable to gather Image URL from Custom Post Type’s; Custom Meta Field
- How to keep custom post type related information
- when looping through custom post data not appearing
- How to avoid duplicate posts queried from custom meta?
- How can I add a meta[] to my custom post type and search by term with the Rest API?
- Show posts from WP Custom Post Type selected from a field in a metabox
- Where is get_post_meta value located?
- Adding a Section for Visitors
- How to Disable option of meta field if that option is selected for any other post in custom post type?
- sorting in wp query based on custom field value
- Custom taxonomy template for custom fields loop [closed]
- Sort loop by custom field from different post type
- Add more custom fields when creating a new custom post type
- How do I extract the contents of a CPT’s custom field for all posts?
- WordPress query in which condition uses custom field
- WordPress loop add heading before first of type
- How to make a shortcode for my WP_Query Loop? [duplicate]
- get_post_meta for Custom Post Type ( CPT )
- WordPress loop, show only one post per custom field
- Delete custom post type metadata without deleting the post in admin area
- How can I get the $key / $value pairs of custom fields that were added via 3rd party plugins or themes?
- How to get past and upcoming post by defining date in custom field?
- How to create content automatically when a post is published?
- Order by custom field attribute
- Get result from Custom Field in Custom Post type
- If i have custom post type with 5 custom fields do i have to create a new loop to reference each one?
- Advanced search form with filters for custom taxonomies and custom fields
- loop through custom post-type with two meta_keys
- Querying meta values within an array
- why get_post_meta is returning 0?
- How do I filter a custom post type loop by a field?
- Display a list of posts whose meta field values are equal to the ID of the post being viewed?
- Check for custom field value in different post type than current one and do something