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
- $wpdb->update with multiple parameters gives error
- Assign / update custom field value for all posts (How can I assign only to posts without custom field value?)
- wordpress allow user to edit user profile with custom fields
- Why do WP_Query results change after updating unrelated Advanced Custom Fields (ACF)?
- How to display data from custom table in wordpress phpmyadmin
- Sort custom meta column by other meta value
- Querying wpdb using PHP
- Creating user status mode in WordPress
- Need Help Fixing My Iframes [closed]
- get_post_meta not working on publishing
- Need help with Google drive API [closed]
- Firing schema via code in functions.php doesn’t work
- Adding number to date not working [closed]
- Is it possible to create a wordpress database with php code?
- Update results, Before deleting the related category [closed]
- How can I add extra word in permalink when someone click download button?
- Saving and Restoring a Canvas on A Individual User Basis
- Seach custom post type posts only by meta fields?
- How WordPress reacts to a lack of memory of the server [closed]
- wpdb php get_var query to get ID for URL image doesn’t work for ID over 999
- How to use thumbnail size of image if I’m only using src to get image
- 3 Slashes appear after Apostrophe in custom fields after updating product-site
- how to retrieve a value if a checkbox is checked
- wp query foreach deleting record returning only first or last item
- Trouble checking if custom woocommerce checkout field is empty or not
- Two queries for a WP_User_Query search work perfectly apart, but not together
- Archive post by meta value + 24hours
- auto-populating custom nav with all items from custom post type
- Database query works fine outside WordPress
- Using $wpdb (WPDB class) ‘replace’ with multiple WHERE criteria problem
- Add / Update Custom Fields After Select Pictures in Media Window
- WordPress update_post_meta updating with empty meta_value field [closed]
- conditional logic for front-end custom field edits
- $wpdb->insert() does not Insert record in a table
- Trying to retrieve post meta
- Automatic Shortcode Creation with Custom Fields [closed]
- Custom field values to taxonomy terms
- Help with a $wpdb MySQL Query
- How would an if statement surrounding a custom field with two variables (holding values) look like?
- Trouble Installing WordPress Get PHP Not Running Answer
- How to add specific meta tags to head of cart and checkout pages in woocommerce?
- Custom Field IF/ELSE PHP
- Fatal error: Call to a member function query() on a non-object
- Which PHP page is the Default Posts Page
- How to combine 2 php functions into one function with a custom field
- Remove the last X characters of a custom field value
- Advanced Custom Fields – display label and value only if value entered
- Get post id within comments loop
- Saving zero in meta box
- Update a buggy installation
- Custom array from a query only write the last row of the query
- Find a way to retrive data updated through metabox plugin to web page
- Why are the details of my todo not saving?
- How to check if a PHP string is different than meta field?
- Can’t save php string to a custom field
- Error using WordPress $wpdb object to get result from custom table
- Display custom field on 404 page outside loop
- How to retrieve the data from the sever and displaying it in a page?
- Why does this update_post_meta function not delete the custom field itself?
- How to show/hide php table rows based on the content of custom fields
- Run str_replace on title and save the output to a custom field
- $wpdb returns duplicate posts
- Can’t update multiple rows with $wpdb query
- Mixing variables into an array when inserting values
- update_post_meta only updating on last loop of foreach
- Only show image from custom field when present
- Wpdb->insert() doesn’t insert new row after the last one
- Hide Heading if ACF Field is empty
- Custom meta box values are not getting saved for my custom post type
- 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)