Assigning CPT-onomies to Attachments – Not Saving Selection
-
Hello, I have set up CPT-onomies so that I can assign a category selection to images (attachments) which I upload to WordPress. My intention to be able to display a gallery of images which can filtered in accordance with the categories assigned to the images.
I have used the following code in my functions.php file to attach / enable an existing a CPT-onomies which I have setup for use with attachments.
add_action( 'wp_loaded', 'my_website_register_cpt_onomy' ); function my_website_register_cpt_onomy() { global $cpt_onomies_manager; if ( $cpt_onomies_manager ) { $cpt_onomies_manager->register_cpt_onomy( 'bathroom_categories', 'attachment' ); } }
The above code now displays the ‘bathroom_categories’ selection box on the media editing page however I have encountered a problem whereby when I select categories to assign to the image and then update the post it doesn’t save the selection I had made??
A 2nd problem I have also noticed is that now when I access the CPT-onomies admin panel and the ‘bathroom_categories’ CPT it tells me “This custom post type is being programmatically registered as a CPT-onomy, which overrides any settings defined below.”
Both problems maybe related as this is new ground for me so I’m hoping for some advice from those in the know if possible?! In the mean time i will continue to read more and see if i get to grips with it myseldf.
Ideally I’d like to be able to set up the CPT via the CPT-onomies admin control panel and have it availble to use / assign to attachements as well as posts if possible.
Looking forward to any help people can offer.
Regards
James
- The topic ‘Assigning CPT-onomies to Attachments – Not Saving Selection’ is closed to new replies.