• 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

    (@bcworkz)

    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.