The custom fields I am using are from the plugin ACF (Advanced Custom Fields).
I finally looked at the ACF website, which I should have done originally, and found the function get_field can specify a post so here is the working code:
$posts = get_posts(array(
'numberposts' => -1,
'post_type' => 'post',));
foreach($posts as $post)
{
$arr = get_field('array', $post->ID);
$arr2 = $arr[0]['string'];
$string = implode(", ",$arr2);
echo $string;
}
Related Posts:
- Add a Jquery Datepicker to custom field in post edit
- Can I query custom meta data through WP_Query
- When using add_post_meta and update_post_meta, is there any way to give the individual arrays keys?
- WP doesn’t show Array Custom Fields?
- How do I search an array stored in a custom-field using WP_Query?
- Correct Approach for Validating Custom Field Input
- Is it possible to store arrays in a custom field?
- use get_posts to get custom field data, but in one array
- Saving an array in a single custom field
- Auto-add paragraphs to custom field?
- Get specific custom field keys from a post and put into an array
- WP Query Returning All Posts
- Passing Custom Field Data as Array to be Saved (Resulting Custom Field Array is inconsistent)
- Run a check for multiple meta key values
- Create an Array of Specific Custom Post Meta
- Remove Body Classes
- Sort alphabetically by custom field
- Redirect to another page using contact form 7? [closed]
- Advanced Custom Fields – display label and value only if value entered
- WordPress loop by meta key that is an array? and how loop multiple arrays
- change order of images attached to post
- Order a WP_Query by meta value where the value is an array
- query_posts with meta_value
- Displaying an ACF list of users
- Meta value Array
- Custom field to array?
- Meta Box Plugin Cloned Fields – Multiple Foreach values
- Show array of meta_value in Edit Post Coloum
- How to Convert Custom Fields from Text to Array?
- Custom field outside the loop and inside an array
- Display metabox title for custom fields with values
- Get custom post fields from multiple metaboxes
- Working with multiple values and metaboxes
- Add custom fields from different posts
- simple fields plugin custom query
- Custom Field: how to save array of multiple key-values in WordPress
- WP post meta – for loop inside for loop
- Store custom field’s multiple values in one user meta key
- How to save array option as text and not integer?
- Should I store arrays in custom fields or create custom tables?
- How can I hide my section title if there is no data in custom fields?
- Show message if statement is false – foreach
- Retrieve IDs from custom field, count and display results differently according to count
- Adding custom field to an array
- How do i output images from URL’s added to the same custom field key
- Extract array from custom field
- Build Array from Input Fields question
- Foreach giving one too many list items, how can I remove the last empty line?
- Custom fields: Split data from single custom field’s sub-array to separate custom fields when saving post
- Grabbing value of input field inside of array
- How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?
- Move from old custom field to new post_thumbnails
- Making a configurable field translatable
- importing data from non-wordpress mysql db
- How to convert custom field value to tag
- Use WP 3.1 Internal Linking ‘widget’ as a meta_box
- Update WordPress Custom Field with AJAX on cached page
- Comments form custom fields order
- Create an array from an array
- how to save multiple custom fields for a post in one go?
- ACF won’t load from a custom JSON location
- Custom User Profile Fields
- How to check for specific meta box value on front end and output accordingly
- Loop to display random posts only if a custom field matches category
- WordPress User Profile Upload – If page is saved file reset
- How to add field above password section in profile page
- How can I add multiple ‘tax_query’ arrays via a loop?
- Replace text in post from cvs
- Front-end editing with custom fields?
- If meta key exists in get posts function otherwise create it
- How do i save and retrieve custom attachment meta?
- Show values of dynamically created custom meta keys
- List taxonomy term “Last Name” + “First Name” (taxonomy custom field) in a post loop
- Filter by custom field (meta_key) using JSON API
- Bulk append custom field to post content
- Vimeo thumbnails
- Display custom field on 404 page outside loop
- meta_value and meta_key filtering returning no posts [closed]
- Woocommerce Retrieving custom field value from orders
- If one meta key value is empty, try to get another meta key, and if both meta keys are empty show something else?
- How can I split my query result in 2 arrays?
- How to order posts by number of Vimeo Likes
- Displaying a video on the homepage via a custom field inside a php widget
- How To Use Custom Fields With .mp3 Links
- how to create meta key name in wp_usermeta table in database
- Display the output from Custom User Fields from a WordPress user profile on a WordPress Custom Page
- Is there a way to determine which user changed a custom field (and when)?
- Show image depending on the number in the custom fields
- Show echo ready in single.php
- Save, update, get and sanitize post meta as HTML not plain
- meta field for numerous links
- Custom field and category query
- Empty the_content for all posts
- Display different category template if custom field is checked
- How can I create more “create attachment” custom field – any idea?
- How to show custom field and parent post id in wordpress attachment page (image.php)
- Display agents (custom post type) alphabetically, except one who always shows last
- Custom Search, MySql Query Gone Wrong?
- Posts sortable column not sorting properly for custom field numbers
- Send checkout page custom field in order email