• Resolved adeparker

    (@adeparker)


    Hi there,

    When adding a Taxonomy field to the template editor, I am not able to choose a number of the taxonomies shown in the list. The taxonomies affected are all ones that were created using the “Pods Admin” plugin. I would like to display a couple of these in the search results.

    I am able to successfully choose a Preview Source (a Pods custom post type) and choose items such as text, featured image, etc. but the custom taxonomies linked to this Pod do not work. Other custom taxonomies (not created in Pods) do work though. They appear in the drop-down list but I am unable to select them. When clicking the taxonomy from the list, I note the below appearing in the Chrome console:

    react-dom.min.js?ver=16.13.1:32 Uncaught TypeError: t.label.toLocaleLowerCase is not a function
        at custom-layouts.js?ver=1.4.0:formatted:12460
        at Array.find (<anonymous>)
        at l.value (custom-layouts.js?ver=1.4.0:formatted:12459)
        at custom-layouts.js?ver=1.4.0:formatted:12583
        at Array.map (<anonymous>)
        at l.value (custom-layouts.js?ver=1.4.0:formatted:12582)
        at l.value (custom-layouts.js?ver=1.4.0:formatted:12595)
        at l.value (custom-layouts.js?ver=1.4.0:formatted:12413)
        at custom-layouts.js?ver=1.4.0:formatted:12037
        at Object.ki (react-dom.min.js?ver=16.13.1:176)

    I am using Custom Layouts in combination with Search & Filter.

    Any suggestions?

    Thanks in advance

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Code Amp

    (@codeamp)

    Hey Ade

    I’ll try to test this locally in the next few days, but I’m guessing the taxonomy field works with regular taxonomies only.

    If you have any more info on your setup to help me recreate that would be most helpful.

    Otherwise I’ll revert with any questions/feedback after giving it a spin – I assume recreating will be straight forward enough.

    Thanks

    • This reply was modified 3 years, 5 months ago by Code Amp.
    • This reply was modified 3 years, 5 months ago by Code Amp.
    • This reply was modified 3 years, 5 months ago by Code Amp.
    Thread Starter adeparker

    (@adeparker)

    Thanks for the quick response.

    What’s odd is that I also have the EventOn plugin installed, and this creates its own custom taxonomies – which work with Custom Layouts fine. Maybe it could be some sort of hierarchical issue, being caused by the way the Pods taxonomy is linked to the Pods post type?

    More than happy to send over screenshots, database snapshots, etc. if it helps.

    Thanks again

    Plugin Author Code Amp

    (@codeamp)

    Hey @adeparker just to let you know I plan on diving into this tomorrow.

    Best
    – Ross

    • This reply was modified 3 years, 5 months ago by Code Amp.
    Plugin Author Code Amp

    (@codeamp)

    Hey @adeparker

    So I managed to take a look at this. Odd thing is, on my first go it seems to work – typical! :/

    I’m wondering, perhaps a setting in the taxonomy field is throwing this off.

    I would check all the settings and make sure they have sensible defaults.

    Based on the error message I would check:
    1) Labels -> Label + Singular Label are both filled
    2) Advanced -> Public is ticked

    Here are my test setting that worked:
    https://drive.google.com/file/d/1o3w2Ja-St2Gbfv4Z6Q0118RTHwxuhP0g/view?usp=sharing

    Happy to take a look at your setup to see if I can spot anything?

    Best

    Thread Starter adeparker

    (@adeparker)

    Hey there,

    Thanks for the reply. I’ve double checked the labels and the Public setting, both are set as you have suggested. Also, the options I have match the GIF you’ve sent over with only one minor difference. I have a Pods custom post type, which the custom Pod taxonomy is linked to. That being said, I’ve just created a new custom taxonomy and linked it to both nothing, and standard posts, and that does the same thing.

    The setup I have is a Directory post type, which has a number of hierarchical taxonomies (Type of Business, Styles Sold, Shipping Locations, etc.) which are all created in Pods.

    Screenshots of my setup:
    https://drive.google.com/drive/folders/1_NjxnLuIbvyITyCFoEGZDFOt1Gt3bZzG?usp=sharing

    Feel free to see if anything obvious jumps out.

    Kind regards

    Thread Starter adeparker

    (@adeparker)

    I probably should add that I can pick fields from the parent post type (e.g. address, phone number) quite happily, and display these on the Template

    I’ve added a screenshot of a breakpoint on the line of code which errors, to the Google Drive link. Maybe that may help

    • This reply was modified 3 years, 5 months ago by adeparker.
    Thread Starter adeparker

    (@adeparker)

    Apologises, keep finding other bits out.

    I’ve added a breakpoint to line 12460 of custom-layouts.js:

    return t.label.toLocaleLowerCase() === e.toLocaleLowerCase()

    When I run through, it loops a number of times fine and the line equates to false. On one loop, that line equates to <not available>. In all cases before, t.label has a value. On this one, t.label: false. The value: “post_status”

    If I run through on one of the other taxonomies, they all equate as false (screenshots added to Google Drive)

    If I manually edit the t.label in Chrome console, Sources –> Scope, the code then runs through and completes ok. I can then select the taxonomy and save the template

    • This reply was modified 3 years, 5 months ago by adeparker.
    • This reply was modified 3 years, 5 months ago by adeparker.
    • This reply was modified 3 years, 5 months ago by adeparker.
    Plugin Author Code Amp

    (@codeamp)

    Hey @adeparker

    Thanks for all the detailed info!

    So yeah I can see the issue from your great debugging.

    As we cycle through your available taxonomies, we reach a taxonomy called post_status and its label is defined as false…

    All your other taxonomies have a label, so don’t fail at this step just this one.

    I’ve just added a “fix” to our plugin (so at least it doesn’t throw an error), so that if a taxonomy doesn’t have a label, it doesn’t get shown.

    You can test this yourself by changing the offending line:

    return t.label.toLocaleLowerCase() === e.toLocaleLowerCase()
    

    to:

    return t.label && t.label.toLocaleLowerCase() === e.toLocaleLowerCase()
    

    However, I think the real question is, what is this taxonomy? Strange it is called post_status

    Anyway let me know how you get on with this workaround for now, and lets see if we can identify the root of this issue.

    Thanks

    • This reply was modified 3 years, 5 months ago by Code Amp.
    • This reply was modified 3 years, 5 months ago by Code Amp.
    Thread Starter adeparker

    (@adeparker)

    Yup, I can confirm that that change does resolve it. Works perfectly now.

    There is a post_status taxonomy in my WordPress installation (I can see it in the Pods Admin, but it wasn’t created by Pods) Looking at the term_taxonomy DB table, I can see a number of post_status items with items such as “New idea proposed”, “An author has been assigned to the post”. I use the Oasis Workflow plugin, which I’ve just discovered has those custom statuses in. There are three fields with that taxonomy in term_taxonomy table, all three have a description though. Which field does the label look at?

    Thanks for all the help

    • This reply was modified 3 years, 5 months ago by adeparker.
    Plugin Author Code Amp

    (@codeamp)

    Hey @adeparker

    Just to let you know we’ve just pushed a release with this fix in.

    RE where does it look, our plugin just asks WP for the label (using a WP function) – I assume that is in one of columns of the taxonomy tables.

    I’ll close this for now then.

    Best
    – Ross

    • This reply was modified 3 years, 5 months ago by Code Amp.
    Thread Starter adeparker

    (@adeparker)

    Thank you.

    Awesome support. Just updated the plugin. Can confirm it works perfectly!

    Plugin Author Code Amp

    (@codeamp)

    No problem Ade – glad this issue is sorted!

    BTW, if you feel inclined (no worries if not), a review from you would be lovely
    https://www.ads-software.com/support/plugin/custom-layouts/reviews/

    Best

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Cannot Add Custom Taxonomy’ is closed to new replies.