• I am looking to run a stand alone file, one time, to attach images from an old non-WP system.

    I have the ability to run:

    require_once(ABSPATH . 'wp-admin/includes/media.php');
    require_once(ABSPATH . 'wp-admin/includes/file.php');
    require_once(ABSPATH . 'wp-admin/includes/image.php');
    
    $image_result = media_sideload_image($images_url, $post_id);
    
    echo '<pre>'; var_dump($image_result);

    for each image.

    However, I need to know what to specify to ensure that it’s reading and inserting into the proper multisite tables. AKA site1, site2, site4, etc etc.

    Any help appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Make a plugin and activate on a specific blog ..
    Or : INCLUDE in a theme that is activated only on the intended blog .

    the second method is risky if the blog is alive , because it will get executed whenever accessed . but I had made it before and it is ok .

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    OR put it in mu-plugins and wrap it with a check for ‘If this is site X…’ ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘media_sideload_image’ is closed to new replies.