• Resolved trawp

    (@trawp)


    DA plugin works fine on posts and pages, but problem on Custom Post Types (Types Version 1.5.5)

    Don’t know which plugin has problem. Deactivated all other plugins, same problem:

    DA recognizes the CPT’s in settings and loads the metabox correctly on the CPT.

    Add New Attachment on CPT always get’s;
    Unexpected error occured. Please refresh the page and try again.

    Thank you in advance

    https://wordpress.org/plugins/download-attachments/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author dFactory

    (@dfactory)

    It looks ok on our installs. But more compatibility tests are on the way.

    Thread Starter trawp

    (@trawp)

    Hi dFactory

    Also have issue submitted with Types plugin

    Thanks

    I too got the “Unexpected error occured. Please refresh the page and try again.” message while trying to add additional attachments to a page.

    I backtraced it to the “public function update_attachments()” in metabox.php

    The problem seems to be that “$_POST[‘post_id’]” equals zero.

    Getting further back into “admin-post.js” the object “wp.media.view.settings.post” seems to be empty. At least the id is zero in there.

    I don’t know where this is normally set, so just take it as a hint.

    As I am only having one page with attachments I hardcoded the post_id of said page into the plugin in metabox.php . Works for me at the moment.

    Plugin Author dFactory

    (@dfactory)

    @badpat, are you sure you did not change anything else? If not we’ll probably need to dive into your site’s admin. (you’ll need to post a topic on our dedicated forum)

    We tested the plugin on our installs and it worked as expected.

    Thread Starter trawp

    (@trawp)

    I finally traced it down to neither of the plugins having a problem.

    The problem was in the Custom Post Types settings:
    Display Sections
    Thumbnail
    must be activated.

    It must be in the new way attachments are called in 3.9. Although I was only using audio attachments, after activating Thumbnails for the CPT all was well.

    Thanks

    Sorry to ressurect this old thread, but I just had some spare minutes and I think I found a solution.

    According to WP Function_Reference – wp_enqueue_media the post has to be specified to which the media should be added. Otherwise: “if you do not set this parameter, uploaded files will not be attached to a post.”

    So, in download-attachments.php change line 404 from:

    wp_enqueue_media();

    to

    wp_enqueue_media( array( 'post' => (isset($post->ID) ? $post->ID : 0 ) ) );

    This fixed the problem for me…

    Cheers,
    Patrick

    Plugin Author dFactory

    (@dfactory)

    But we don’t won’t to attach it to a post. At least it was not our intention.

    Maybe a plugin option would be handy here.

    Plugin Author dFactory

    (@dfactory)

    It will be modified in the upcoming release.
    Thx @badpat

    Regards,
    Bartosz / dfactory

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Problem after update to WP 3.9’ is closed to new replies.