• https://codex.www.ads-software.com/Function_Reference/wp_insert_attachment

    wp_insert_attachment( $attachment, $filename, 37 );
    this states that $filename is “Location of the file on the server. Use absolute path and not the URI of the file. The file MUST be on the uploads directory.”

    when i append the full physical path of this file relative to the server root and look at the image in the media library the file uri is incorrect.

    when i use the path to the file from the uploads directory the uri is correct.

    what is meant by this – is it the absolute path of the image file starting at the uploads directory?

  • The topic ‘wp_insert_attachment’ is closed to new replies.