• I have three custom metaboxes on an audiobook review blog-in-progress that group together: (1) information about the book, (2) information about the audiobook, and (3) the review itself. All of my custom taxonomies are related to one of these three groups.

    I would like to move the taxonomies into the appropriate custom metaboxes rather than having them float around on the sidebar in no particular order, with no particular logic. Intermingling the custom fields and the custom taxonomies would be a lot cleaner and make posting a lot faster (at least for me). Has anyone successfully done this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    I can’t say I’ve successfully done this, but there’s no reason you couldn’t. Like other metabox content, you become responsible for properly saving the user selections within the metabox. This could conflict with selections in the usual WP metaboxes in the sidebar.

    You can of course manually hide the usual WP metaboxes to prevent potential conflicts, but other users may not do so on their own. Custom metabox layouts are stored in usermeta. You could determine what values need to be saved in order to hide the usual metaboxes for the current user and set them by code.

    Thread Starter Rose

    (@eos-rose)

    My installation has only one user: me. So I’m not really concerned with other users. I just need an example that does something similar to what I’m aiming for. I’m not quite advanced enough to code from complete scratch just yet.

    I am confused about the implication that the WP taxonomy boxes couldn’t be hidden for the post type as a whole and not just for a particular user.

    Moderator bcworkz

    (@bcworkz)

    Sorry, I don’t have an example I could provide beyond a generic metabox tutorial. You already have specific metabox code, you need to simply combine the relative portions into a single metabox.

    I’m not sure how to clear up your confusion. The default taxonomy boxes show up any time a taxonomy is related to a post type. If you remove the relation, then the boxes would no longer appear, but then it would not be possible to assign terms to the posts, even by code. Choosing to hide or show metaboxes using the screen’s options is a user interface device, so such settings are stored per user. Does that help?

    FWIW, not only can each user show or hide metaboxes, but they can be dragged around and re-ordered. Some can move between columns, others not. Caution: if you chose to move a right column box into the main, wider column, be sure that’s what you want. It’s difficult to move some boxes back to the right once they are in the main column. By moving the boxes around, you may decide that’s close enough and it’s no longer worth the effort to custom code a special meta box.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add custom taxonomies to a custom metabox with a few custom fields’ is closed to new replies.