• Resolved anatoliy06

    (@anatoliy06)


    If I add a field to the course using a plugin Advanced Custom Fields and output this field in frontend, in loop of courses an error occurs “Unexpected token < in JSON at position 1”.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author ThimPress

    (@thimpress)

    Hi anatoliy06,

    Can you provide us with the image and pages are you have errors?

    Thanks.

    • This reply was modified 3 years, 8 months ago by ThimPress.
    Thread Starter anatoliy06

    (@anatoliy06)

    link to my site: http://pakhomov.beget.tech/
    Screenshot of the main page: http://pakhomov.beget.tech/wp-content/uploads/2022/09/2022-09-22_10-51-19.png – this happens when I add a function the_field(‘some_tag’); (Advanced Custom fields plugin) to the template learnpress

    Plugin Author ThimPress

    (@thimpress)

    Hi anatoliy06,

    With LP v4.1.7.1 you can’t do that, LP will not load another plugin except some plugins accept load.

    You can read function getPluginsMustLoadInUrl on LP. We defined list plugin load on Request get list courses like:

    'wp-json/lp/v1/courses/archive-course'      => [
    	'learnpress/learnpress.php' => [],
    	'learnpress-woo-payment/learnpress-woo-payment.php' => [
    					'woocommerce/woocommerce.php',
    				],
    			],

    We must do that, because, other plugins make get courses very slow, like plugins: Woo, PMS, Elementor,… Although no need to load when calling on that.

    So if you still want to load ACF plugin, you must add that plugin to ‘wp-json/lp/v1/courses/archive-course’. And up version, but when update new version LP it can lose.

    In the future, we’ll add the option for managers easy choose plugins can load on a request.

    Thanks.

    Thread Starter anatoliy06

    (@anatoliy06)

    Help me how to do this correctly. I don’t understand how to add a dependency correctly.
    To a file learnpress/mu-plugin/class-lp-mu-plugin.php I add the code to the function getPluginsMustLoadInUrl(). But I don’t understand what needs to be written in the third line:

    'wp-json/lp/v1/courses/archive-course'      => [
    				'learnpress/learnpress.php' => [],
    				'learnpress/learnpress.php' => [
    					'advanced-custom-fields-pro/acf.php',
    				],
    			],

    And up version of LP to 4.1.7.2.

    Plugin Author ThimPress

    (@thimpress)

    Hi,

    You need to add ‘advanced-custom-fields/acf.php’ (a slug of plugin ACF) to that.

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Learnpress have problem with ACF plugin’ is closed to new replies.