get_post_meta()
with the 3rd parameter set to true
will return a single item with the key specified in the 2nd parameter (_custom_field
in your code). If this item is an array, it’ll return as the array. In your case, it appears that the data is:
array(
'video_url' => '',
)
…which is why, when you try to echo
it, it’s printing Array
to the screen.
I’d suggest something more like this:
<?php
$meta = get_post_meta(get_the_ID(), '_custom_field', TRUE);
echo $meta['video_url'];
?>
…or, if you’re expecting multiple video_url
s, you could do this:
<?php
$meta = get_post_meta(get_the_ID(), '_custom_field');
foreach ( $meta as $item ) {
echo $item['video_url'];
}
?>
(Note that it also appears that, in the metadata you’ve posted, there’s an empty value for the actual video_url
, but I can’t say what might have caused that.)
Related Posts:
- How to update custom fields using the wp_insert_post() function?
- How to display multiple Post meta_key/meta_values by SQL query
- How to use multiple query with same meta key
- How can update custom meta for all posts
- Use ajax to update_post_meta
- how to increase custom post value by one most efficiently?
- How can I create a list of page titles from custom meta values?
- Store multiple custom field as post meta per post(css, js, html, 2 link) [closed]
- How to VAR_DUMP a $variable during checkout process (Is my product meta callable?)
- Is it possible to retrieve all posts with a certain value for metadata?
- Non-Closing PHP Query in WordPress Loop
- Querying Database with wpdb
- WordPress loop by meta key that is an array? and how loop multiple arrays
- How to store multiple custom meta box
- Order a WP_Query by meta value where the value is an array
- Add a custom class to the body tag using custom fields
- Define category ID using get_post_meta
- Hide a div when a custom field is empty
- WordPress stripping out custom field tags
- Order category posts by last word of custom field
- Add a “custom field” to a category that can be retrieved when viewing the category page with get_post_meta
- How to update custom fields when post is published?
- What is the correct way to search 3 custom fields only in WordPress?
- WP post meta – for loop inside for loop
- When working with a post, almost all wp_postmeta are deleted
- Updating Lat and Lng of posts automatically gives sporadic results
- Order by in foreach
- If custom field doesn’t exist, or exists and it’s true show title?
- Metadata on the WP_Post object
- Get meta_id along with meta_key and meta_value
- So much data in postmeta
- How can merge two arrays values in one array and save in database
- How to handle a custom form in wordpress to submit to another page?
- WooCommerce: How to display item meta data in email confirmation using woocommerce_order_item_meta_end
- Getting movie and serial on actor page
- Would manually deleting the dumping data fix a “#1062 – Duplicate entry ‘1’ for key ‘PRIMARY'” phpMyAdmin error?
- POSTS list in WordPress by views
- Compare two meta key values against each other inside the get_posts array?
- Removing WordPress profile fields from non-admins
- If Meta Checkbox is checked, do something?
- Show custom field if it exists, and show different elements if it doesn’t
- Change description on specific WooCommerce product status change
- Custom field value not saving when it contains a URL?
- Call External Object in Class Function During Callback
- tracking number field in Woocommerce order [closed]
- WSoD being caused by this piece of code
- Sort posts by custom fields value using dropdown menu
- How to display data from custom table in wordpress phpmyadmin
- Creating user status mode in WordPress
- Need Help Fixing My Iframes [closed]
- Update results, Before deleting the related category [closed]
- How WordPress reacts to a lack of memory of the server [closed]
- how to retrieve a value if a checkbox is checked
- Trouble checking if custom woocommerce checkout field is empty or not
- Add / Update Custom Fields After Select Pictures in Media Window
- $wpdb->insert() does not Insert record in a table
- Remove the last X characters of a custom field value
- Why are the details of my todo not saving?
- Can’t save php string to a custom field
- How to retrieve the data from the sever and displaying it in a page?
- Can’t update multiple rows with $wpdb query
- Mixing variables into an array when inserting values
- How to use two meta_compare in an array?
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- Basic wpdb update question
- Cannot access $wpdb, comes back NULL
- form $_post action value gets truncated after it passes through two forms
- Add a counter for mouseovers (custom field)
- Add row to custom database Table and delete all rows older than 1 day
- Show field if it has contents on Advanced Custom Fields
- the_meta – no get_the_meta query?
- Dynamically added custom fields not displayed on WooCommerce email notifications
- get value from get_post_meta then reuse it in another get_post_meta
- How can I add diffrent editable text fields?
- Include custom fields in search
- update_term_meta() only updating once on certain meta keys
- Loop for recently (updated_post_meta) posts?
- Creating multiple tables with Plugin
- Conditional formatting on data fetched from MYSQL
- Using zip code to display custom data in Admin Order Details
- Generating 3 random numbers and saving them in database
- ACF – Can’t get custom post type by taxonomy
- Displaying SQL query result from user input via wpdb
- update_post_meta Not Processing Array Data (Not Sure What I Am Missing)
- What syntax is this? “{{post.price}}”
- Update user_email via php – WP 4.7
- Unable to pass variable to database
- How to get the first letter from custom field?
- Meta box not saving spaces
- custom field meta-box with dropdown/autocomplete
- If Elseif Query
- Querying multiple meta_keys in WordPress SQL query
- get_post_meta is always empty when I use wp_mail
- Display custom meta box in my template file
- How to display the date under the post title?
- Too many if’s and else if’s ?? – Must be better way [closed]
- Advanced Custom Fields Show PHP in Text Areas
- inner-wrap div pushing custom table far down on page
- Search custom post type posts only by meta fields?
- How to pass value to add_filter wpcf7_form_tag from another function?