Support

Account

Home Forums ACF PRO Relationship field show no posts on form

Solving

Relationship field show no posts on form

  • hello
    In a recent wordpress project I use advanced custom field and wp-stream that created two custom post type free view live and free view vod.
    I create a group of custom field for free view vod and some of them has “relation” type with other post type, but when I try to add or edit free view vod post all the field are there but those who have type “relation” are empty … it take some time to search and stay blank while there are many post in the related post type

  • How many posts are there in the related post that is trying to be loaded?

    The symptom you are describing, not listing any posts, means that the query of those posts is failing. Either the query is timing out because it is too complex or there are too many posts, or there is an error in the PHP code that is doing the query.

  • Hello,
    As you see in the third picture, now i have 10 post that should be load. The query is very simple, i just load those post based on a post type. How can i debug if the query fail?

  • The query is done using AJAX. In order to see if there is a PHP error when the query is done you’ll need to enable WP_DEBUG and logging and you’ll need to look it the error logs to see if there are any errors happening when the fields is trying to load results.

    https://wordpress.org/support/article/debugging-in-wordpress/

  • So @hube2 after some debugging into browser console i discover that there is some error into the console for that particular VOD CPT. And i have to confirm that in the same website these error do not appear into any other CPT, only this one (so i don’t think it is an error of library)

    Uncaught TypeError: acf.get(...) is null
        initialize http://myproject.test/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf-input.min.js?ver=6.0.5:1
        e http://myproject.test/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js?ver=6.0.5:1
        Model http://myproject.test/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js?ver=6.0.5:1
        n http://myproject.test/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js?ver=6.0.5:1
        n http://myproject.test/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js?ver=6.0.5:1
        n http://myproject.test/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js?ver=6.0.5:1
        newField http://myproject.test/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf-input.min.js?ver=6.0.5:1
        getField http://myproject.test/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf-input.min.js?ver=6.0.5:1
        getFields http://myproject.test/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf-input.min.js?ver=6.0.5:1
        jQuery 2
            each
            each
        getFields http://myproject.test/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf-input.min.js?ver=6.0.5:1
        1580 http://myproject.test/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf-input.min.js?ver=6.0.5:1
        o http://myproject.test/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js?ver=6.0.5:1
        doAction http://myproject.test/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js?ver=6.0.5:1
        doAction http://myproject.test/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js?ver=6.0.5:1
        7806 http://myproject.test/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js?ver=6.0.5:1
        jQuery 13
            e
            t
            setTimeout handler*Deferred/then/l/<
            c
            fireWith
            fire
            c
            fireWith
            ready
            $
            EventListener.handleEvent*
            <anonymous>
            <anonymous>
    acf-input.min.js:1:51804
  • So for example in other form where i created this kind of relationship there is no such error and the admin triggered the script
    POST http://myproject.test/wp-admin/admin-ajax.php

    And the XHR return a nice JSON file with all data from the same relationship

    What do you think can be the issue?

  • Hello @hube2 any suggestions? Please

  • if acf.get() is null then the only thing I can think of is that either the acf script is not being loaded or your script is calling the acf function before it is loaded.

  • Hello @hube2 thanks for your response but that is very weird because in all other form in the same website I don’t get that issue.

  • are there any other errors on the page before that error? To be honest, I have do idea what VOD CPT is.

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

You must be logged in to reply to this topic.