Title: custom field shortcode
Last modified: April 19, 2019

---

# custom field shortcode

 *  [webmaster52](https://wordpress.org/support/users/webmaster52/)
 * (@webmaster52)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/custom-field-shortcode-2/)
 * Hi all
    I’m using this piece of custom field code posted by zarie3 a year ago://
   function get_custom_field( $atts, $content ) { return get_field($atts[‘fname’]);}
   add_shortcode( ‘ke_get_field’, ‘get_custom_field’ ); //
 * Everything works fine on the live site using PHP7.3, but when I try to use the
   site on localhost via WAMP (Windows 64), using PHP7.3.1 I get the following warning,
   and the site won’t load:
 * ( ! ) Warning: Use of undefined constant ‘ke_get_field’ – assumed ‘‘ke_get_field’’(
   this will throw an Error in a future version of PHP) in C:\wamp64\www\NACHP\wp-
   content\themes\NACHP\functions.php on line 91
 * I understand that that there were deprecation of certain functions in PHP 7.2.1,
   but can’t see why it works on my Ionos cloud server and not on localhost.
 * I’m not a php guy, and would appreciate any help with this, especially if there
   is a workaround.
 * Cheers

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/custom-field-shortcode-2/#post-11450313)
 * It’s hard to tell because the forum’s parser converts quote chars. I think your
   code may have “curly quote” chars and not the required “straight quote” chars,`‘
   ke_get_field’ vs 'ke_get_field'`. Look closely, it’s hard to tell the difference.
 * To ensure your code is not corrupted in future posts, please demarcate posts 
   with backticks or use the code button.

Viewing 1 replies (of 1 total)

The topic ‘custom field shortcode’ is closed to new replies.

## Tags

 * [custom field](https://wordpress.org/support/topic-tag/custom-field/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Localhost Installs](https://wordpress.org/support/forum/localhost-installs/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [7 years, 1 month ago](https://wordpress.org/support/topic/custom-field-shortcode-2/#post-11450313)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
