[Multisite Content Copier] PHP error when trying to copy specific posts using Multisite Content Co

I am receiving an error message in our php error logs (below) when trying to copy specific posts from one network site to another when selecting copy images. Sometimes a portion of the selected posts will come over, other times none will. If we go back and repeat the process and leave the "copy images" checkbox unchecked, the posts all come over but then the image urls are referencing the source site within the actual html link. If you look in the media library sometimes you see placeholders where the images would be and they look like broken image previews (ie the photo isn't showing). So I imagine it tries to copy the image, can't copy it or copy its metadata and then fails to do the find/replace within the post content since it thinks the image hasn't been copied.

Error from log:
PHP Fatal error: Call to undefined function wp_generate_attachment_metadata() in /home/catapult/public_html/wp-content/plugins/multisite-coontent-copier-post-type.php on line 562

  • James Morris

    Hello Jake Zangrilli

    I'm afraid there's something very unusual going on here because there is no file named post-type.php in Multisite Content Copier. I've checked on the latest version and that file does not exist. Also, I'm afraid I've been unable to replicate the symptoms you are experiencing.

    In order to help you better with your issue, would you please grant me access to your site and server so I can perform some advanced debugging?

    NOTE: Please make a full backup of your site before sending the following information.

    Please visit the Contact page and complete the form with the following information:

    https://premium.wpmudev.org/contact/#i-have-a-different-question

    Option: I have a different Question

    Subject: "Attn: James Morris"

    In the Message box, please provide the following:

    - link back to this thread for reference
    - any other relevant urls

    - Admin login:
    Admin username
    Admin password
    Login url

    - Hosting Control Panel Login
    Admin username
    Admin password
    Login url

    ~OR~

    - FTP credentials
    host
    username
    password
    (and port if required)

    Best regards,

    James Morris

  • Jake Zangrilli

    Hi James - My apologies, when I copied from the error log it somehow copied incorrectly. I've repasted it here to confirm that the file is properly referenced:
    [06-Jun-2018 18:14:55 UTC] PHP Fatal error: Call to undefined function wp_generate_attachment_metadata() in /home/catapult/public_html/wp-content/plugins/multisite-content-copier/inc/content-copier/content-copier-post-type.php on line 562

    I'll go ahead and get you those relevant credentials. Please note that this is a live/production multisite so please don't do anything that would cause issues to all the sites (ie activating/deactivating network plugins, etc) without first checking with me. Thank you!

  • James Morris

    Hello Jake Zangrilli

    After investigating this issue further with my colleague Ari we found a minor bug in the plugin that was causing this issue.

    wp_generate_attachment_metadata() is a core WordPress function. wp_generate_attachment_metadata() is located in wp-admin/includes/image.php. So, we found in our plugin the mistake.

    require_once( ABSPATH . 'wp-admin/includes/image.php' ); was not defined in the proper location.

    We've updated content-copier-post-type.php on your server to correct this issue.

    Given that the site is live, I'd rather not make any content changes. Would you please confirm all is working correctly on your site?

    Best regards,

    James Morris

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.