Title: PHP Code to insert Custom Field before
Last modified: November 2, 2022

---

# PHP Code to insert Custom Field before

 *  Resolved [sootedninjas](https://wordpress.org/support/users/sootedninjas/)
 * (@sootedninjas)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/php-code-to-insert-custom-field-before/)
 * Got a project that has a very short deadline and don’t have much time to do a
   thorough research.
 * Using PODS, I defined an optional text custom field for post.
 * Essentially its a json-ld script to be used as specific schema definition for
   the post.
    I s there a code example available that will pick up this custom field
   and inserted just before </head> of the post?

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

 *  Thread Starter [sootedninjas](https://wordpress.org/support/users/sootedninjas/)
 * (@sootedninjas)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/php-code-to-insert-custom-field-before/#post-16158722)
 * Trying to replicate this
 * [https://www.godaddy.com/garage/3-ways-to-insert-javascript-into-wordpress-pages-or-posts/](https://www.godaddy.com/garage/3-ways-to-insert-javascript-into-wordpress-pages-or-posts/)
   
   SEARCH FOR: Method 3: Use Advanced Custom Fields
 * It work in one of the website that I am working on BUT on another site for some
   reason ACF is NOT showing in the WP Dashboard.
 * Decided to use PODS. At least PODS is shwoing up in the Dashboard.
 * ——————-
    Is there a PHP code example available that will pick up this custom 
   field and inserted just before </head> of the post?
 *  Plugin Author [Jory Hogeveen](https://wordpress.org/support/users/keraweb/)
 * (@keraweb)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/php-code-to-insert-custom-field-before/#post-16160599)
 * Hi [@sootedninjas](https://wordpress.org/support/users/sootedninjas/)
 * Pods doesn’t include such a feature with the UI.
    Of course you can use the Pods
   Code field to create the JS and then use our functions to output this into the
   <head> code. Also see: wp_add_inline_script. [https://developer.wordpress.org/reference/functions/wp_add_inline_script/](https://developer.wordpress.org/reference/functions/wp_add_inline_script/)
 * Cheers, Jory
 *  Thread Starter [sootedninjas](https://wordpress.org/support/users/sootedninjas/)
 * (@sootedninjas)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/php-code-to-insert-custom-field-before/#post-16161510)
 * thanks for the reply.
 * But for what I wan to do, its too complicated.
 * In, ACF all I have to do is inject this code in the proper spot and its done.
 * <?php the_field(‘pods_custom_field’); ?>
 * Simple definition, Simple Code. Takes all the fuss away
 *  Plugin Author [Jory Hogeveen](https://wordpress.org/support/users/keraweb/)
 * (@keraweb)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/php-code-to-insert-custom-field-before/#post-16162053)
 * Hi [@sootedninjas](https://wordpress.org/support/users/sootedninjas/)
 * You can do that with a custom Pods field as well.
    See: [https://docs.pods.io/code/field-functions/pods_field_display/](https://docs.pods.io/code/field-functions/pods_field_display/)
 * Example:
    `<?php echo pods_field_display( 'POD_NAME', get_the_ID(), 'FIELD_NAME');?
   >`
 * We even support the ACF `the_field` functions so you could just leave it as you
   have now as long as the field name is correct.
 * Cheers, Jory
    -  This reply was modified 3 years, 7 months ago by [Jory Hogeveen](https://wordpress.org/support/users/keraweb/).
    -  This reply was modified 3 years, 7 months ago by [Jory Hogeveen](https://wordpress.org/support/users/keraweb/).
 *  Thread Starter [sootedninjas](https://wordpress.org/support/users/sootedninjas/)
 * (@sootedninjas)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/php-code-to-insert-custom-field-before/#post-16162195)
 * that’s more I like it.
 *  Thread Starter [sootedninjas](https://wordpress.org/support/users/sootedninjas/)
 * (@sootedninjas)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/php-code-to-insert-custom-field-before/#post-16162196)
 * thanks

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

The topic ‘PHP Code to insert Custom Field before’ 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/)

 * 6 replies
 * 2 participants
 * Last reply from: [sootedninjas](https://wordpress.org/support/users/sootedninjas/)
 * Last activity: [3 years, 7 months ago](https://wordpress.org/support/topic/php-code-to-insert-custom-field-before/#post-16162196)
 * Status: resolved