• Resolved muneebkiani

    (@muneebkiani)


    Hi,

    The Taxonomy Terms field, instead of returning the selected item, return all the terms.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the feedback!

    What you describe is not normal.

    What PHP code do you use to retrieve the Taxonomy Terms field value? get_field('my_taxonomy_terms')?

    Thanks!

    Regards.

    Thread Starter muneebkiani

    (@muneebkiani)

    Yes, and also tried with addition of post id, ?get_field( ‘my_taxonomy_terms’, $id );

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the details!

    I just ran some test, and it works fine on my end. Here is the video of my test.

    Can you try to setup a simple test like I did in my video, see if you get the same result? Here the my Field Group Json Export. You can save that json into a file, and import it from the “ACF > Tools” admin menu.

    The Field Group is called “My Taxonomy Terms” and will be displayed on any Post Type: Page in your WP Admin. The Taxonomy Terms field will only display the “Category” Taxonomy.

    Try to select a Category, and run get_field('my_taxonomy_terms', 15); (where 15 is the post id of your test page). You should get the same result as in my video.

    If the issue is still there, then it probably means you have some custom code/hook either in a third party plugin or in your theme which break the feature.

    In order to isolate the problem, I would recommend clone your website on a development / staging environment using Duplicator, or with your hosting backup solution. Then try to disable all your plugins one-by-one (at the exception of ACF Pro & ACF Extended) until you find which one cause the issue.

    If the problem persists, try switch to the native WP Twenty Twenty Two theme, to make sure you don’t have any custom code in your theme which would break the field.

    In all cases you should be able to confirm it works like I did, by setting up a clean WP install with ACF Pro + ACF Extended only.

    You can read more about how to setup a favorable environment for debugging WordPress & ACF in our guide here.

    Let me know if you found something!

    Thanks!

    Regards.

    Thread Starter muneebkiani

    (@muneebkiani)

    Thanks for the comprehensive reply. I managed to pinpoint the issue. If you select the dropdown (in settings) along with stylized UI, it returns values from all other “Taxonomy Terms” fields on the page.

    So actually it is not return all term but merging output of fields (if Stylized UI option is selected)

    https://prnt.sc/l4IrMmGmQ2NL

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the details!

    I’ve setup a test with the specs you reported, and it still works fine in my end. Here is the video of my test.

    Please note that on your screenshot, you enabled the “Save Terms” & “Load Terms” settings on your Taxonomy Terms field. If you did that on all your Taxonomy Terms, it is normal that the terms are merged together, because the terms are assigned on the current post (just like the native WordPress Taxonomy metabox in the sidebar of your post).

    So the selected terms are all assigned to the current post (“Save Terms” setting). And when you retrieve the Taxonomy Terms field value, it will just return the terms assigned to the post (“Load Terms” setting). If you want to avoid that, you have to disable the “Save Terms” & “Load Terms” settings from your Taxonomy Terms fields. The same logic is applied to the native ACF Taxonomy field (see documentation).

    Hope it helps!

    Have a nice day!

    Regards.

    Thread Starter muneebkiani

    (@muneebkiani)

    Thanks a lot, indeed the issue was with the “Load Terms” which I overlooked.

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    I’m glad to hear it now works as expected!

    PS: Thanks for the review, it’s always much appreciated ??

    Have a nice day!

    Regards.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.