Custom taxonomy on attachment post type can't be heirarchical?

Have used CustomPress to create a Custom Taxonomy called "Person" and made it hierarchical. It is set to support the post types 'posts' and 'attachments'.
The input box looks just fine in the posts window, but is just a plain text box in the Attachments/Media window.
(screenshot attached)

This is not totally unexpected as it happened the same way when I created the taxonomy manually.
But I know it doesn't HAVE to be that way. I was originally playing with a plugin called PS Taxonomy Expander that does put it into checkboxes or radio buttons if required (second screenshot attached). The plug in, however, errors out (third screenshot attached) when you assign a custom taxonomy to BOTH posts and attachments. It's OK with one or the other, but not both.

So my questions are:
1) the initial behaviour is as expected? No checkboxes for hierarchical taxonomy on attachment pages or is there another setting I could be missing?
2) any chance your developers would add to your plug in what the PS Taxonomy Expander does? (apart from the error part, that is)

  • DavidM
    • DEV MAN’s Mascot

    Hi jageo,

    I'm not sure how this really should work though even given the screenshot from PS Taxonomy Expander the display still appears rather non-standard as there's no place to add a taxonomy term there, no?

    As far as I can see the standard behavior at this point would be to provide a text field for the taxonomy terms there. I'll run this by the lead plugin developer though to see what thoughts he might have on this one and perhaps regarding adding that functionality.


  • jageo
    • Flash Drive

    Thanks David

    Yes, definitely non-standard input on the Media page itself, although the rest of the interface is fairly regular and to add new values you use the sub-menu that appears under whichever post type you've created the taxonomy. But you could say that WordPress itself is using non-standard input on the media page too.
    The nice thing about hierarchical taxonomy is that is shows the terms outright, and when creating pages for my clients there are times when I really want them to have the structure of checkboxes.
    So anyway, you're saying behaviour is as expected. Even tho' the taxonomy is heirarchical it will appear and accept input as a comma separated values text box on the attachment page.
    As a side note for the developers, there are a couple other things that PS Taxonomy Expander does that are lovely - on the Settings -> Writing panel you can set the default value for each taxonomy, even to have a different value for the taxonomy under different post types. Clever!

  • jageo
    • Flash Drive

    Hi Andrey
    I'm testing out the new update and have run across two issues. ( starting from clean install, localhost with MAMP, and this is the only plugin activated)

    1) I created a hierarchical custom taxonomy that is only for post type 'attachment', but I can not find where I am able to add the terms to this taxonomy. I would expect the taxonomy name to appear as a sub-menu under media but it does not. If I edit the custom taxonomy to apply to post type 'post' and 'attachment', the sub menu does appear under the Posts menu, as expected. (And once I added some terms they do appear as checkboxes on the Media Page. Fantastic!)

    2) I created a non-hierarchical custom taxonomy assigned to post type 'attachment'. I uploaded a photo and entered a term in the appropriate text box, and saved my changes. But it appears that the term is not being saved? More likely it is that existing term is just not being displayed in the text box, but I'm not sure how to test that. (Have phpMyAdmin open but not sure which table to look through.)

  • Andrey
    • The Incredible Code Injector

    Hi @jageo,


    1. I did that taxonomy name to appear as a sub-menu under media. And you can open page of add/edit the terms to this taxonomy.

    But, one thing, which I can't do - after you open page of add/edit the terms to this taxonomy - the menu "media" will be minimized.

    It's becouse the "Attachment" post type is specific post type :slight_frown:

    Maybe in the future I will find a solution.

    2. I fixed it.

    I not released the new version, yet.

    I will do it soon, with more changes.

  • jageo
    • Flash Drive

    So sorry Andrey, I've done more testing and version 1.1.7 has term saving issues with the heirarchical taxonomy.

    1) version 1.1.7 is not saving the hierarchical taxonomy settings on attachment posttypes. No matter what term(s) I select, when I come back to edit the media all the checkboxes are blank.
    If I edit an attachment that had terms previous saved (from my 1.1.6 version) it removes these terms
    I reinstalled 1.1.6 to confirm it does save the terms again.
    I believe 1.1.7 is saving the nonhierarchical terms, just not the hierarchical taxonomy terms

    2) I've installed the plugin on a sandbox site (on hostgator) and some php errors are showing up (screenshot attached). This was a clean install sandbox, default theme, and customfields is the only plug in running.
    The errors show up ONLY when I have the combination of a hierarchical taxonomy connected to an attachment post type.
    If I have a hierarchical on a post posttype there are no errors displayed
    If I have a non-hierarchical on an attachment posttype there are no errors displayed
    (Until now I've been testing locally on a MAMP install and believe now that MAMP is suppressing these error messages, which is why i didn't notice them before. My apologies. I've downgraded to 1.1.6 on the sandbox site and the php error message also appear so it is not something new to 1.1.7)

    Let me know if I can test something else to help eliminate variables

  • jageo
    • Flash Drive

    This may or may not be related, please ignore it if this is just noise:

    Funny thing I noticed last night. I downgraded back to 1.1.6 because I wanted to start inputting terms and getting my theme templates ready. But I found that while I could work with the terms, I could not save any changes made to the media title, caption, or description field.
    I was able to change and save my taxonomy terms while working in 1.1.6. , but if I wanted to change the media title or caption I had to disable the plugin.

    I downgraded one more step to 1.15 and I was able to save changes to media title, caption, etc.
    For curiousity, I upgraded all the way to 1.17 and I was able to save changes to media title, caption etc. (but as above, could not save changes to terms)

    I tested this both in sandbox and in local MAMP just to be sure.
    Wow, attachment post types are tricky little beggars to work with.

  • jageo
    • Flash Drive

    The only thing I'm seeing that is unexpected is warning message on media page:
    Warning: Invalid argument supplied for foreach() in /home/myfoster/public_html/wp-content/plugins/custompress/core/content-types.php on line 794
    (screenshot attached)
    It, however, doesn't 'appear' to be affecting anything adversely.

    Otherwise, everything seems to be working as expected.
    1) the headers already sent errors have gone, no longer appearing after each 'save changes' from media page
    2) hierarchical terms on attachment page can be set, changed, saved, edited all as expected
    3) media title, caption, description can be set, changed, saved etc.
    4) I've tried a hierarchical, a non-hierarchical taxonomy and a custom field on the attachment post-type.
    5) I've got a taxonomy.php that successfully shows these attachment based terms are there, and responding as they ought.
    6) the submenu to add terms appears under Media for the taxonomies associated with attachment post types.

    I tested first on my local install, then on my sandbox site, and I even have it running on my live site now. While I do wish WordPress would style the taxonomy boxes on the media page as it does on the post and custom posttypes, I'm sure that will come with time. I'm happy to at have the functionality at least, thanks to your plug in. :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.