define( ‘ATTACHMENTS_DEFAULT_INSTANCE’, false );
When I enter a custom instance, I get 2 attachment boxes on posts and pages but nothing on my custom post types.
Please help. I’m on WP 3.5.
Please make sure you add that line ABOVE this line in
/* That's all, stop editing! Happy blogging. */
Adding it below that line means it’s too late to take effect.
Great plugin Jonathan! But like jjust1, I display 2 attachment boxes on the included post types (ie posts) but nothing on my custom post type admin pages.
Added the constant to the wp-config like you mentioned and that removed 1 of the boxes but still didnt add any attachment box to my custom post type page.
Any ideas? I am using WP 3.5 and Attachments (latest ver.)
I think the documentation isn’t quite clear on this topic, but, if you want to use the plugin with custom post types, you have to create a custom instance as described in the documentation. You can copy pase it and just modify the array entry ‘post_type’ so it contains your custom post type. Well, on second though it seems clear enough 😀
Hope I’m not mistaken, but at least it works for me 🙂
naldope: did you follow the instructions here? Can you paste what you’ve added and where? Also include the CPT name you’re trying to target.
herrkris: Documentation improvement suggestions are more than welcome, I’ve done the best I can in trying to explain things but in my experience it’s more about people not wanting to read the documentation than actually following it. What is it you feel is confusing about the usage docs? I’ve done my best to recreate the nicer GitHub docs into the plugin page on .org, but I’m limited by the readme.txt requirements and lack of styling there.
Hey Jonathan, sorry for the confusion, the only thing that wasn’t quite clear to me — and yes you’re correct with “people not wanting to read the documentation” — that I have to add a custom post type. After reading the documentation and the code example everything was pretty clear to me.
Perhaps you can add a little note to the usage section. If you want to use the plugin with a custom post type you have to create a custom instance and change the value for the post_type. I think when you quick scan the documentation you tend to skip the code block and wonder why the plugin isn’t working with the custom post type. 🙂
herrkris: OMG! That did it! Thank you.
jonathan: I think I was focused on the line to add my instance:
$attachments->register( 'my_attachments', $args ); // unique instance name
instead of adding my CPT here:
// all post types to utilize (string|array) 'post_type' => array( 'post', 'page' ),
Maybe place a comment right next to there saying // insert your custom CPT here, if needed
Thank you both so much!
herrkris: Great feedback, thank you! I’ll get something added in an upcoming release for sure.
Naldo: Gotcha, thank you as well, I’ll spend some time making the docs more obvious as soon as I can.
- The topic ‘Can't add to custom post types’ is closed to new replies.