• billspluginreviews

    (@billspluginreviews)


    No data is returned on my posts/pages with ACF custom fields and WP code snippets after php 7.4. No error is thrown it just stops working starting with 8.0. Other than that everything functions. Any suggestions?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello @billspluginreviews,

    Could you kindly verify the versions of ACF and Insert PHP Code Snippet plugins to ensure they are up to date? It’s important to use the latest version of both plugins.

    Additionally, please check the error log for any relevant information. If you continue to experience issues, kindly share the snippet code so that we can further assist you.

    If you are a premium user, please feel free to contact [email protected] with the snippet code for personalized assistance.

    Thanks and Regards,
    Anjali

    Thread Starter billspluginreviews

    (@billspluginreviews)

    Advanced Custom Fields 6.2.3
    WPCode Lite 4.1.13

    No error found in error logs

    Thread Starter billspluginreviews

    (@billspluginreviews)

    As mentioned earlier, this snippet works under PHP 7.4 and stops working at PHP 8.

    <?php>
    ?>
    <br />
    <strong>Year(s):</strong> <? the_field('start_year'); ?>-<? the_field('end_year'); ?><br />
    <strong>Bill Fulton role:</strong> <? the_field('bill_fulton_role'); ?><br />
    <strong>Production:</strong> <? the_field('production'); ?><br />
    <strong>Episode:</strong> <? the_field('episode'); ?><br />
    <strong>Media Category:</strong> <? the_field('category'); ?><br />
    <strong>Production Co:</strong> <? the_field('production_co'); ?><br />
    <strong>Director/Producer:</strong> <? the_field('dir-prod'); ?><br />

    Hello @billspluginreviews ,
    The issue you’re facing might be related to the use of short tags (<?) which are not recommended and can cause problems, especially in newer PHP versions.
    So please try replacing the code section with full PHP tags,

    <?php
    
    ?>
    <br />
    <strong>Year(s):</strong> <?php echo get_field('start_year'); ?>-<?php echo get_field('end_year'); ?><br />
    <strong>Bill Fulton role:</strong> <?php echo get_field('bill_fulton_role'); ?><br />
    <strong>Production:</strong> <?php echo get_field('production'); ?><br />
    <strong>Episode:</strong> <?php echo get_field('episode'); ?><br />
    <strong>Media Category:</strong> <?php echo get_field('category'); ?><br />
    <strong>Production Co:</strong> <?php echo get_field('production_co'); ?><br />
    <strong>Director/Producer:</strong> <?php echo get_field('dir-prod'); ?><br />
    

    Make sure you are using this code within the context of WordPress loop or on a template that displays a single post or page where these fields are defined.

    Also, ensure that you have the Advanced Custom Fields plugin installed and activated, and the field names are correct. If the issue persists, you might want to check for any PHP error messages or log entries that could provide more details about the problem.

    Hope this helps.

    Thread Starter billspluginreviews

    (@billspluginreviews)

    Yes, enabling short tags in PHP 8.2 was the answer. Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘No data returned after PHP 7.4.’ is closed to new replies.