PHP code snippets Critical Error
-
I use a PHP code snippet to display a download link for the ACF plugin, however when I activate this plugin i get a critical error. The backend page shows the following message:
“INSERT PHP CODE SNIPPET caused a fatal error and has been deactivated in the FDP backend pages.”
The error specifically reads:
Uncaught Error: Call to undefined function get_field() in wp-content/plugins/insert-php-code-snippet/shortcode-handler.php(99) : eval()'d code:2 Stack trace: #0 wp-content/plugins/insert-php-code-snippet/shortcode-handler.php(99): eval() #1 wp-includes/shortcodes.php(355): xyz_ips_display_content(Array, '', 'xyz-ips') #2 [internal function]: do_shortcode_tag(Array) #3 wp-includes/shortcodes.php(227): preg_replace_callback('/\\[(\\[?)(xyz\\-i...', 'do_shortcode_ta...', '[xyz-ips snippe...') #4 wp-content/plugins/elementor-pro/modules/dynamic-tags/tags/shortcode.php(54): do_shortcode('[xyz-ips snippe...') #5 wp-content/plugins/elementor/core/dynamic-tags/tag.php(35): ElementorPro\Modules\DynamicTags\Tags\Shortcode->render() #6 /home/otterbhouse/staging
Just if it is any interest, the snippet in question is the following:
<?php $file = get_field('menu_file', 402); if( $file ): ?> <?php echo $file['url']; ?> <?php endif; ?>
I have had to deactivate the plugin so the functionality on my site still works. Is there anyway to stop it checking for errors/ even leave this page alone completely as I can assure I have absolutely no errors when I don’t have this plugin deactivated.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘PHP code snippets Critical Error’ is closed to new replies.