Title: Custom fields data problem
Last modified: December 16, 2022

---

# Custom fields data problem

 *  Resolved [jimike](https://wordpress.org/support/users/jimike/)
 * (@jimike)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/custom-fields-data-problem/)
 * I am building my first theme site, so I expect this is self inflicted. Added 
   custom post page through WP and custom fields through Pods. When using <?php 
   echo get_field(‘field name) or <?php echo the_field(field name). Return on page
   is that of the most recent post. Example: with 3 pages. Page posts 1 and 2 will
   update to show that of Last (most recent) input from new page post 3 for data
   and galley. (also tried creating custom post pages through Pods with same outcome.)
 * <?php. <?php echo get_post(‘the_field’) works without showing “$” or commas for
   currency or commas for numbers. Looks to be pulling from WP custom field.
 * Using <?php $gallery = the_field(‘gallery’);   if($gallery):?>Unable to pull 
   gallery all together from custom field in pods on older posts. All galery’s update
   to newest post.
 * What am I doing wrong?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Support [pdclark](https://wordpress.org/support/users/pdclark/)
 * (@pdclark)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/custom-fields-data-problem/#post-16302300)
 * Make sure you’re running the functions within the main loop. Context matters —
   if you’re outside the main loop, it will generate a new query. Use Pods [auto-templates](https://docs.pods.io/displaying-pods/pods-templates/auto-templates/)
   or templates within your theme’s [template hierarchy](https://wpshout.com/wordpress-template-hierarchy/).
 *  Plugin Support [pdclark](https://wordpress.org/support/users/pdclark/)
 * (@pdclark)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/custom-fields-data-problem/#post-16302306)
 * See [https://codex.wordpress.org/The_Loop](https://codex.wordpress.org/The_Loop)
 *  Plugin Support [pdclark](https://wordpress.org/support/users/pdclark/)
 * (@pdclark)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/custom-fields-data-problem/#post-16308223)
 * Also, `the_field()` is an ACF function. While it is sometimes interchangeable,
   you may have better luck with [https://docs.pods.io/code/field-functions/pods_field_display/](https://docs.pods.io/code/field-functions/pods_field_display/)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Custom fields data problem’ is closed to new replies.

 * ![](https://ps.w.org/pods/assets/icon.svg?rev=3286397)
 * [Pods - Custom Content Types and Fields](https://wordpress.org/plugins/pods/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pods/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pods/)
 * [Active Topics](https://wordpress.org/support/plugin/pods/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pods/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pods/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [pdclark](https://wordpress.org/support/users/pdclark/)
 * Last activity: [3 years, 5 months ago](https://wordpress.org/support/topic/custom-fields-data-problem/#post-16308223)
 * Status: resolved