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?
- how to retrieve a value if a checkbox is checked
- Removing link ” from ” on meta_value in custom feilds
- 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
- Passing args to WP_User_Query am I using meta correctly?
- jQuery – Automatic event trigger does not **really** check my form
- Get posts with same meta value as current post
- Want to make A CSS if meta key value is empty
- Using Wishlist Member and I need to access a user’s status
- Jetpack post types Portfolio or Testimonials support for custom fields?
- Add custom field to all posts in specific post_type
- Trying to update_post_meta function
- Merge Multiple Custom Fields into one New Custom Field for Searching
- Is there a better way to list all database terms alphabetically?
- Add & store extra fields – WordPress Comments
- Change the sort order for posts to include custom field
- Button inside Custom Meta Box triggering the Update Button
- Why is my Custom Meta Box Field Inputs NOT saving?
- Filter multiple custom fields Values with Check boxes
- UPDATE on SELECT results. A SQL query to swap Author with Meta Box value
- Get registered custom fields or post meta even if empty
- Alter main archive, to show posts with meta as last
- Add microdata from schema.org [closed]
- Customizing user data
- Displaying multiple URLs as custom field values
- Add additional ‘description’ field for defined roles / role metadata?
- Can’t display errors in attachment_fields_to_save
- Change the main loop WordPress impact on the server?
- How to get categories with posts by custom field value?
- How to load an assets based on custom field value?
- displaying and sorting comments by a custom field (using PODS plugin) [closed]
- Meta Query returns wrong number of posts
- Struggling with array and foreach loop
- Declaring in variables [closed]
- Pass current post title to a predefined link
- auto-populating custom nav with all items from custom post type
- How to hide a custom field if there is not a value
- Adding auto-complete to custom gravity field not working
- how to display a widget only on a page where the custom field is defined?
- Checking array against author id in loop
- Show values of custom post meta on ‘Add new post’ page?
- custom-meta-box checkboxes from loop won’t save
- Custom dropdown field added to media gallery; how to get it to save properly?
- Can I create a template or doctype for my blog site?
- Sort custom post type by multiple custom fields
- Custom field, add class to anchor tag
- Custom post meta field effect on the performance on the post
- Set post to unpublished after one week depending on condition
- How to find a post using XML-RPC without knowing ID