[Resolved] Attachments not showing for custom post type editing
I have a similar issue others have had with the attachments pane not showing up in the add/edit post for a custom post type, but with the difference that I never had the legacy version installed. I had WordPress 3.3.1 and Attachments 188.8.131.52, and my attachment pane was showing up fine for posts, pages and my custom type “resources”. Then I upgraded to WordPress 3.5.1 and Attachments 3.5, and now the attachments pane only shows up for post and page adding/editing. It won’t show up in the editor, and the posts I had added that included attachments no longer showed their attachments on the site. I tried downgrading the plugin back to 184.108.40.206 but it made no difference.
Did you run the migration script and check out the documentation for all the changes in Attachments 3.0+ from the legacy version?
Edit sorry just re-read your post and you didn’t need to migrate. Can you elaborate on where its showing up vs. not showing up? I’m a bit unclear on that.
I created a custom post type called “resources” using the Custom Post Type UI plugin. After upgrading, when I try to add or edit a resource the My Attachments panel does not show up in the admin. But the panel is still there for both posts and pages. Also the attachments I had attached to my resources before upgrading are no longer showing up on the public site.
Are you using the default instance or did you create your own? If you’re using the default instance it only supports Posts/Pages out of the box and you’ll need to create a custom instance. If you’re using a custom instance you’ll need to add
If you’ve been using Attachments and want to continue using the same instance as you’re using on your Posts/Pages, just name it
attachmentsas per the docs and it will overwrite the default instance and you can keep using all of that data.
That was it! For some reason the attachments panel previously showed up for my custom post type even though I had not specified it to do so in the custom instance. When I added it to the array in $args it showed up right away. I should’ve been paying more attention to the $args variable. Thanks so much!
That’s strange it was showing up without having specified it, if you by chance find that happening again if you could shoot me a note that’d be much appreciated (in case it’s a bug somewhere)—either way, glad you’re sorted out, enjoy the plugin! If you’ve got a spare minute a Review is much appreciated.
Hi Jonathan! I have been working on a site for someone and ran into this exact issue. I have identified that the issue lies in the fact that whoever built this site, set up a multitude of custom page types and as a result, the ‘Attachments’ meta box doesn’t show when editing these.
I have read the doc on setting up a custom instance, but I find myself scratching my head still, although the GitHub instructions seems extremely well written. How can I add this already working Attachments function on pages that have been customized, outside of the normal WordPress Posts/Pages? I know I modify the functions.php file, but how do I point this code in functions.php, and instruct it to display oh these custom pages?
I hope this makes sense, I am just seeing no results by simply copying the code and leaving it at that. Do I need to customize the php arrays?
Thanks in advance and keep up the great work!
To try and be even more specific. The font end DOES display images that were attached using this feature in the past. The issue is that when editing one of these custom pages, the option or meta box ‘Attachments’ isn’t showing up anywhere. The images on the site are still there. I’m also seeing that in the theme files, there is a document called attachments.php, which I can only assume is there to forgo editing functions.php. Would I be right in this assumption?
Hi there, it sounds like the active theme or another plugin is interfering along the way at some point. The best way to see if that’s the case is to deactivate all plugins except Attachments and switch to the default WordPress theme to see if Attachments shows up on your edit screens as expected. If it does, you can start by activating your theme to see if it triggers the issue. If not, you can activate plugins one by one to see what the culprit might be. If this approach still yields a problem with Attachments we can troubleshoot a bit further.
Thanks a lot for the reply. I disabled all my plugins, exception Attachments. Refreshed my custom page in edit mode, but saw no Attachments meta box. Without reinstating plugins, I changed the theme back to the default WP theme, but of course, with it goes my Custom Pages, so I couldn’t get to the issue at hand with this technique.
So, I’m still here. The problem only seems to be in the Attachments option not showing up for my Custom Pages.
I’m still struggling to get any of the Attachments working on my custom pages. Anybody have any other suggestions or thoughts that I might try out?
Resolved. For all of those future Attachments user who struggle with this same issue, try this…
Force the legacy version in your wp-config.php file, putting this in at the TOP, not the BOTTOM:
define( ‘ATTACHMENTS_LEGACY’, true ); // force the legacy version of Attachments
I tried so many different things and in the end, it was a matter of putting this at the top instead of at the very end of the document. Now my attachments feature appears on every post and page, custom or default.
Hope that helps.
I could not get the attachments meta box to appear for my custom post type, when adding new: my-publication
I discovered that I had to edit line 1225 of
$post_type = str_replace( ‘-‘, ‘_’, sanitize_title( $_GET[‘post_type’] ) );
$post_type = str_replace( ‘_’, ‘-‘, sanitize_title( $_GET[‘post_type’] ) );
As far as I can see, a post type can be registered containing either a “-” or a “_”, so maybe the str_replace is superfluous??
(string) (required) Post type. (max. 20 characters, can not contain capital letters or spaces) “
Either way, that aside, this is a very useful plugin, thanks
- The topic ‘[Resolved] Attachments not showing for custom post type editing’ is closed to new replies.