Home Forums General Issues ACF warning messages appear in frontend


ACF warning messages appear in frontend

  • Hi all,

    Using WordPress (latest version) Custom Post Types (latest version), ACF Pro (latest version) and Elementor Pro (latest version)

    I am posting my problem here because I have come up against a brick wall trying to get support for the issue, both from ACF Pro and from Elementor Pro.

    My website uses Custom Post Types (latest version), ACF Pro (latest version) and Elementor Pro (latest version), and has been working perfectly for 3 years, until about 1-2 weeks ago. Then I started to get Warning messages on the web page that uses ACF Pro fields to display a CPT called “products” (NOT Woocommerce products because this is a “catalog” site, not an e-commerce site, and I am not using Woo anyway). Plus, I have NO WARNINGS ACTIVATED inside any plugin on the site, nor in the wp_config.php file (DEBUG = FALSE) so the first thing I’d like to know is why I am seeing Warnings at all! Fatal errors – fine, I expect to see those if something bad goes wrong, but why is my site being defaced by mere Warnings?

    I would like to post a screenshot of these warnings, but no way to do so on this forum.

    Basically, I get a message like this, but repeated 14 times in a row at the top of the web page:
    Warning: Undefined array key 0 in /home/clients/[cient-number]/web/wp-content/plugins/elementor-pro/modules/dynamic-tags/acf/tags/acf-image.php on line 40

    The only variation to this message is as follows, where acf-url.php replaces acf-image.php.

    Warning: Undefined array key 0 in /home/clients/[cient-number]/web/wp-content/plugins/elementor-pro/modules/dynamic-tags/acf/tags/acf-url.php on line 34

    I do not have any caching plugin, and clear my brower cache all the time when working on the site, compulsively.

    ACF Pro says the problem comes from Elementor, and Elemntor’s reply to me shows they clearly have no clue what is causing it.

    At this stage I would be very happy to just comment out the code causing the problems, but have no idea how “essential” it is to ACF functionality. I have quite a lot of php dev experience, but zero experience of the WP framework and how the core & plugins fit together.

    Can someone somewhere give me ANY pointers here?

    Many thanks

  • After looking at the code for elementor pro it is my guess that the code in elementor pro that gets the value of the field is being called before ACF is initialized. This guess is also based on the fact that a recent change in ACF that prevents the retrieval of values before ACF is initialized and this was done to prevent the use of fields in ACF that are not created using ACF. This means that any call to ACF before the hook ‘acf/init’ is called will return an empty value.

    But again, this is only a guess, and because you are using elementor pro I really don’t know how to figure it out.

    Do you have any custom PHP code added to this site outside of the plugins mentioned that could be called?

    I would start by looking at the HTML output directly before the error and try to figure out where output is created.

  • Hi John, and many thanks.

    Re: custom PHP code, I do have 3 tiny PHP files sitting in my child theme’s includes directory, each of which interrogates an ACF field, and based on the status of that field, returns a different value to the shortcode on the product webpage. The code these 3 files contain is simply this:

    <?php function ph_isSold_shortcode( $atts ) 
    	/*$status = get_field('field_5fbfa6ddbe952');//the Sold? checkbox */
    	$status = get_field('sold_status');
    	if ($status)
    		return $status;
    add_shortcode( 'soldornot', 'ph_isSold_shortcode' );


    There is one like this for the Rare checkbox, and another for the “Just Arrived” checkbox. = 3 files

    A fourth file in this directory displays a “Send Purchase Enquiry” button if and only if the Sold checkbox has been set to “on”.

    There is a 5th file in this includes dir, but this comes from Elementor, is called admin_functions.php and does only this (documentation at top file):
    * Hello Elementor admin functions.
    * @package HelloElementor

    * Show in WP Dashboard notice about the plugin is not activated.
    * @return void
    … their code here.

    Would my 4 files be causing the warning messages, in your opinion?

    Many thanks!

  • shortcodes should not be an issues as long as the shortcodes are only run in some type of content area. The only reason a shortcode could cause the problem is if you call the do_shortcode() function before initialization, which would be odd.

    Without seeing the code of the other two files there isn’t any way for me to know. You could try commenting out the code in these files and see if that eliminates the error.

  • OK – I commented out the shortcodes and that didn’t change anything.

    When you say
    “Without seeing the code of the other two files there isn’t any way for me to know. You could try commenting out the code in these files and see if that eliminates the error.”

    do you mean the other two files that do exactly the same thing, or the one that shows the Purchse button and the Elementor admin_functions.php? The other two that do the same thing just refer to different field_ids, and the Purchase button refers to yet another field_id.

    The admin_functions.php contains the following code:

    function hello_elementor_fail_load_admin_notice() {
    	// Leave to Elementor Pro to manage this.
    	if ( function_exists( 'elementor_pro_load_plugin' ) ) {
    	$screen = get_current_screen();
    	if ( isset( $screen->parent_file ) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id ) {
    	if ( 'true' === get_user_meta( get_current_user_id(), '_hello_elementor_install_notice', true ) ) {
    	$plugin = 'elementor/elementor.php';
    	$installed_plugins = get_plugins();
    	$is_elementor_installed = isset( $installed_plugins[ $plugin ] );
    	if ( $is_elementor_installed ) {
    		if ( ! current_user_can( 'activate_plugins' ) ) {
    		$message = __( 'Hello theme is a lightweight starter theme designed to work perfectly with Elementor Page Builder plugin.', 'hello-elementor' );
    		$button_text = __( 'Activate Elementor', 'hello-elementor' );
    		$button_link = wp_nonce_url( 'plugins.php?action=activate&plugin=' . $plugin . '&plugin_status=all&paged=1&s', 'activate-plugin_' . $plugin );
    	} else {
    		if ( ! current_user_can( 'install_plugins' ) ) {
    		$message = __( 'Hello theme is a lightweight starter theme. We recommend you use it together with Elementor Page Builder plugin, they work perfectly together!', 'hello-elementor' );
    		$button_text = __( 'Install Elementor', 'hello-elementor' );
    		$button_link = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ), 'install-plugin_elementor' );

    plus some styling and some html containing various button links.

  • I don’t know.

    This is what I do know. The error in your OP is happening on a line where elementor Pro is getting a value for from the ACF field using the ACF function get_field(). This is returning no value. The only thing that will cause this is if the field does not exist or get_field() is called before ACF in initialized.

    here is the line in elementor pro

    list( $field, $meta_key ) = Module::get_tag_value_field( $this );

    the php function expects that the value on the right of the = is a non empty array. Here is the function being called.

    // For use by ACF tags
    public static function get_tag_value_field( Base_Tag $tag ) {
      $key = $tag->get_settings( 'key' );
      if ( ! empty( $key ) ) {
        list( $field_key, $meta_key ) = explode( ':', $key );
        $document = Plugin::elementor()->documents->get_current();
        if ( 'options' === $field_key ) {
          $field = get_field_object( $meta_key, $field_key );
        } elseif ( ! empty( $document ) && 'loop-item' == $document::get_type() ) {
          $field = get_field_object( $field_key, get_the_ID() );
        } else {
          $field = get_field_object( $field_key, get_queried_object() );
        return [ $field, $meta_key ];
      return [];

    I’m guessing that this function is failing to get the ACF field object and returning an empty array. There isn’t

    Is it possible that you have a field set in an element widget that no longer exists?

  • Update: problem identified, workaround in place

    On a hunch, I deleted the two video fields which fetched videos from Youtube. Problem solved!

    There was NOTHING to indicate the problem came from them. The links to the videos were set up in a Product field, appearing as links like this one:

    and these links all worked perfectly. But as soon as I deleted them from the Products, and removed all reference to them from the template that controlled how they appeared online, the Warning messages vanished. Go figure!

    The product pages now look fine (see this example: but of course there are no more videos. On balance I think the client will prefer this to bug-causing video links; I’ll be informing them shortly.

    Any idea, John, what has happened between Youtube and ACF to create this phenomenon?

    Many thanks for your work so far, anyway.

  • Do you have any ACF fields that have the same field name as the one used for the video? In other words the value of the field is stored with the same “meta_key” in the DB as an ACF field. That’s about the only thing I can think of if the field appears unrelated.

  • John, I’ll need to do some searching around in the DB’s postmeta for my “product” post-types before I can comment on that. I wouldn’t think it’s possible, but who knows? If I find anything interesting I will definitely let you know!


Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.