Register images uploaded though FTP using API

[ad_1]

Hello,
I have a routine that uploads multiple images in wordpress, they are not showed in the media library because they are not registered. Is there a way using API? I see there are plugins but I need to schedule and don’t want to use one.

Thank you

[ad_2]
1 Comment
  1. Might require some custom coding and a CRON schedule / Scheduled action, which might make it possible. In that case i’d suggest using a temporary / landing folder for the images, and then have the CRON task setup the data in the database, and move the file upon completion, to avoid potential mixups in the wp_content folder (or wherever the images might be stored on the server).

    This function should handle most of the serverside tasks for registering the file:

    [https://developer.wordpress.org/reference/functions/media_handle_sideload/])

    Alongside with this:

    [https://developer.wordpress.org/reference/functions/wp_insert_attachment/])

    As seen here in an example:

    [https://rudrastyh.com/wordpress/how-to-add-images-to-media-library-from-uploaded-files-programmatically.html])

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer