Skip Navigation

[Resolved] get_fields('options') failing with an image field…

This support ticket is created 5 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Waqar 5 years, 1 month ago.

Assisted by: Waqar.

Author
Posts
#1602313

I have a plugin of my own that was using a old version of toolset. The problem I am having is entirely within Toolset / WordPress code, however.

I have some fields including image fields defined on the "Options" page. When my code now seeks to get that information, I get an error as shown below. Can you tell me if the usage of the "options" style ACF interface has changed radically int he last year or so?

My initiating code is "$this->Options = get_fields('options');"

The error stack is...

12 0.1454 4254104 get_field_objects( ) ...\api-template.php:269
13 0.1770 4899928 acf_format_value( ) ...\api-template.php:342
14 0.1770 4899928 apply_filters( ) ...\acf-value-functions.php:141
15 0.1770 4900224 WP_Hook->apply_filters( ) ...\plugin.php:206
16 0.1770 4900768 _acf_apply_hook_variations( ) ...\class-wp-hook.php:287
17 0.1770 4901112 apply_filters_ref_array( ) ...\acf-hook-functions.php:101
18 0.1770 4901112 WP_Hook->apply_filters( ) ...\plugin.php:249
19 0.1770 4902200 acf_field_image->format_value( ) ...\class-wp-hook.php:287
20 0.1770 4902200 acf_get_attachment( ) ...\class-acf-field-image.php:347
21 0.1779 4910544 get_attachment_link( ) ...\api-helpers.php:3133

Culminating in !

(!) Fatal error: Uncaught Error: Call to a member function using_permalinks() on null in C:\Users\ken\Local Sites\instalite-demo\app\public\wp-includes\link-template.php on line 424

( ! ) Error: Call to a member function using_permalinks() on null in C:\Users\ken\Local Sites\instalite-demo\app\public\wp-includes\link-template.php on line 424

#1603513

Hi Kenneth,

Thank you for contacting us and I'd be happy to assist.

The use of "get_fields" function and the error stack both suggests that your code is using some functionality involving the "Advanced Custom Fields" plugin and not Toolset:
hidden link

To get the most accurate and up-to-date information about that plugin's methods/functions, we'll recommend getting in touch with its official support.

If you feel the error is related to any of the Toolset fields or functions, you're welcome to share some more context of exactly what action(s) your plugin performs.

regards,
Waqar