get_post_custom()
will return an array of arrays. You need:
echo $custom_array['my_custom_field'][0];
Alternatively, you can use get_post_meta()
with the $single
flag as true
:
echo get_post_meta( get_the_ID(), 'my_custom_field', true );
Related Posts:
- getting all values for a custom field key (cross-post)
- How to filter post listing (in WP dashboard posts listing) using a custom field (search functionality)?
- What is “meta_input” parameter in wp_insert_post() used for?
- Query Posts or Get Posts by custom fields, possible?
- Saving custom data for each user
- Attaching Metadata to a Taxonomy Item
- Save Custom Fields for Variations Product
- Filter results with custom field values and dropdown
- Retrieve custom fields on Categories, using WP-API
- Archive sorting functions by custom fields (front-end)
- Order by custom field date?
- can you set a default value to a custom field
- Order by custom field date with ASC order
- Determine when a custom field was last updated?
- use get_posts to get custom field data, but in one array
- automatically set “Featured Image” the same as the og:i that is set in a custom field
- Display value of custom field not working
- WP_query : meta_key with custom rule for specific value
- How can I combine meta_query queries?
- How to save taxonomy term meta?
- Can you ungroup Custom Fields?
- How to get the db table row that has the biggest value in the meta value?
- making sense of admin-ajax
- MySQL query to set wp_postmeta using term_taxonomy_id value
- Insert attachment ID in custom field from media uploader
- Add url from Custom Field as ‘Featured Image’. Code not working
- Custom Meta Box not Saving in Posts with Gutenberg Editor
- Update Custom post field by Ajax on cached site
- How to update a meta field of type array in Gutenberg
- Bulk remove post meta
- How to create html block to display extra information on woocommerce single product page
- How to Display pages with a Custom Fields in one page
- Run a check for multiple meta key values
- Getting the ID of any image for use in functions.php
- Is it better practice to use ‘This Name Format’ or ‘this-name-format’ for custom fields?
- Storing a DateTime Value in a Sortable Custom Field?
- WordPress Rest API to call page data associate with custom meta
- Unsaved changes in metabox inputs not detected in the block editor
- Declaring in variables [closed]
- How to show a post if was published less than two hours ago?
- Custom field as Slug
- How to save the date/time of last update of an extra user profile field?
- How to populate custom field dropdown box based on prior selection?
- Saving Custom Field Data before Publish
- Define a post’s title and slug from Custom Fields
- How can you include custom post meta in search without calling each key?
- Custom wysiwyg editor doesn’t execute shortcodes?
- Populate Javascript code with value from WordPress Custom Field?
- How to hide a div based on contents of custom field
- Hook after meta created
- How to store post meta in an array
- Get image url using image id
- Set checkbox as checked by default in a metabox
- Get categories query not working in function.php
- wordpress custom loop ascending descending posts by custom field
- Can I use a Custom Field as the Featured Image URL?
- Only show when content added via custom field
- Using a custom field inside a shortocde
- Add Custom Profile Field as Notes
- Sanitize user input fields before wp_insert_post
- Increment user meta data by 1 each time a page is visited
- Woocommerce frontend edit custom fields
- Related query shows same image in loop
- Can’t Output get_post_meta?
- Data URI in custom fields
- Add specific custom fields to post formats
- Displaying an ACF list of users
- Meta value Array
- wp_editor on custom meta textarea field – images and html fails
- using custom fields on content.php file of my theme
- Hide / Show Custom field depending of the page ID (Magic Field 2)
- How to show certain data on certain interval of period
- How do I include a template file while allowing it to render its own dynamic content added via custom box?
- Stripping and/or altering the content of a custom field (video URL)
- Custom field outside the loop and inside an array
- How to parse a huge list of users using a CRON function?
- Counting post fields
- add_comment_meta not working properly
- how to enable custom fields in the Gutenberg post editor
- Missing Custom Fields
- Automatically Add Tags Taxonomy in Post from Custom field’s value
- How to get data from user meta custom fields created with acf-pro plugin?
- Is there any way to make a custom field for a post only if the author is a certain user?
- How to I change the value of a custom field on the home page?
- Retrieving and inserting data in custom fields
- How to add custom fields to images for image source text and URL
- Stop truncation of shortcodes in custom text fields?
- Save custom post data outside of default post form
- Get custom field outside wordpress loop on new php page
- Query Posts based on custom field value
- Wrap this custom field with hyperlink link
- Metabox nonce not allowing update
- Cannot get tags working from a WPAlchemy metabox with wp_editor()
- Retrieve IDs from custom field, count and display results differently according to count
- How do i put a per page theme in a special box/div?
- How can I duplicate “Add Custom Field” with just JavaScript?
- unlink() doesn’t delete the uploaded file
- Custom field not showing
- Display filesize of custom field value
- How to automatically create a custom field when a post is published?