Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
If you're experiencing a situation where your website is not loading, but the wp-admin works correctly, and you encounter a PHP Fatal error indicating 'Call to undefined function acf_get_options_pages()' in the WPML_ACF_Options_Page class, this summary is for you.
Solution:
We recommend updating to ACFML version 2.1.4.1, which includes a fix for this issue. After updating, verify that the problem is resolved by checking if your website loads correctly without errors.

If this solution does not apply to your case, or if it seems outdated, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the issue persists, please open a new support ticket at WPML support forum for further assistance.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Itamar 11 months, 2 weeks ago.

Assisted by: Itamar.

Author Posts
August 20, 2024 at 11:25 am

Giacomo Torricelli

Background of the issue:
I am trying to: Hi there, the website is not loading anymore but the wp-admin works correctly. I can see in the log this: [20-Aug-2024 11:22:15 UTC] PHP Fatal error: Uncaught SymfonyComponentDebugExceptionFatalThrowableError: Call to undefined function acf_get_options_pages() in /public_html/wp-content/plugins/acfml/classes/class-wpml-acf-options-page.php:281 Stack trace: #0 /public_html/wp-content/plugins/acfml/classes/class-wpml-acf-options-page.php(262): WPML_ACF_Options_Page::isValidOptionPagePostId('wpml-ls-2-de') #1 /public_html/wp-includes/class-wp-hook.php(326): WPML_ACF_Options_Page->append_language_code_for_option_pages('wpml-ls-2-de') #2 /public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters('wpml-ls-2-de', Array) #3 /public_html/wp-content/plugins/advanced-custom-fields/includes/api/api-helpers.php(2208): apply_filters('acf/validate_po...', 'wpml-ls-2-de', Object(WPML_LS_Menu_Item)) #4 /public_html/wp-content/plugins/advanced-custom-fields/includes/api/api-template.php(20): acf_get_valid_post_id('wpml-ls-2-de') #5 /public_html/wp in /public_html/wp-content/plugins/acfml/classes/class-wpml-acf-options-page.php on line 281 Link to a page where the issue can be seen: hidden link

Symptoms:
The website is not loading, but the wp-admin works correctly. A PHP Fatal error is logged: 'Call to undefined function acf_get_options_pages()' in the WPML_ACF_Options_Page class.

Questions:
Why is the website not loading while wp-admin works correctly?
How can I resolve the PHP Fatal error related to 'acf_get_options_pages()'?

August 20, 2024 at 11:54 am
August 20, 2024 at 12:36 pm #16087104

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

Our developer has already developed a fix for this fatal error with ACFML 2.1.4. here is what you need to do.

1. Take a backup of your site in case something goes wrong.

2. Edit this file with a code editor:
/wp-content/plugins/acfml/classes/class-wpml-acf-options-page.php

3. On line 280, replace this:

	private static function isValidOptionPagePostId( $postId ) {
		return (bool) wpml_collect( acf_get_options_pages() )
			->first( Relation::propEq( 'post_id', $postId ) );
	}

with this:

	private static function isValidOptionPagePostId( $postId ) {
		return function_exists( 'acf_get_options_pages' )
			&& wpml_collect( acf_get_options_pages() )->first( Relation::propEq( 'post_id', $postId ) );
	}

4. Save the file.

This should fix the fatal error.

**** Important! Please make a full site backup (files and DB) before you proceed with those steps****

We've tried implementing this fix on your site, but we are blocked from editing the plugin files.

Can you please try this fix and tell us if it is working?

Thanks a lot,
Itamar.

August 21, 2024 at 12:54 pm #16090511

Giacomo Torricelli

Hi Itamar,
Today, I updated to 2.1.4.1, so I've not been able to test your fix manually. However, everything seems to be working correctly.

I need to remove the path on the server from my original message because it contains the domain name; can you help me with that?

August 21, 2024 at 4:03 pm #16091526

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

Yes, we included the fix in ACFML 2.1.4.1, so indeed, everything should be fine now.

I removed the path as you requested.

Regards,
Itamar.