• Hello,

    What I’m trying to achieve is the following: when a user is creating a new post, when he clicks to select a category, to display custom taxonomy box related to that category.

    I guess I have a add a simple onlick/showdiv command to the category select field, but how do I hook post.php to do this?

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You are welcome,

    The way I understand:

    The place where a user clicks to select a category IS the taxonomy box for the category taxonomy. category is a native taxonomy as opposed to a custom taxonomy.

    If you do create a custom taxonomy and properly attach it to ‘post’, your custom taxonomy box will appear adjacent to the category native taxonomy box.

    Thread Starter cyberlp23

    (@cyberlp23)

    The problem is that the custom taxonomy is not attached to a post type, but to certain categories.
    So I have to wait until a post is saved (or I click on the selected category) to have the custom tax box displayed.
    Which works fine with jquery, the only problem being that if I want to edit the post, the boxes are not displayed by default, and I have to unclick/click again on the category to have them displayed…

    custom taxonomy is not attached to a post type, but to certain categories.

    I didn’t know that could be done. Thanks for teaching me something.

    So I have to wait until a post is saved (or I click on the selected category) to have the custom tax box displayed.

    Have you tried adding an action to action-hook? :

    post_submitbox_misc_actions
    Runs when an editing page gets generated to add some content (eg. fields) to the submit box (where the publish button is shown). No function arguments.

    Reference: https://codex.www.ads-software.com/Plugin_API/Action_Reference#Post.2C_Page.2C_Attachment.2C_and_Category_Actions_.28Admin.29

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Onclick when selecting a category in post admin UI’ is closed to new replies.