admin管理员组

文章数量:1130725

(All plugins disabled) I have some strange issues with the media library. It's an old site that I have been managing for the last 2 years. The site has dated media folders on disk going back to /2010/01/.

The dropdown in media library to filter items by date only goes back to June 2013. If I select that date it shows two images. However if I look on disk there are about 70 images (not including other sizes).

I ran the following query in PMA as a routine:

BEGIN
    SELECT meta_value AS filename
    FROM wp_posts p
    JOIN wp_postmeta pm ON p.id = pm.post_id
    WHERE p.post_type = 'attachment' AND pm.meta_key = '_wp_attached_file'
    INTO OUTFILE '/tmp/filenames.log' 
    LINES TERMINATED BY '\n';
END

Which gave me file paths from 2010 but, for example, in 2010/01 it only returned one image path when there are actually 7 images on disk in that folder.

Is there something, code or plugin, that will recurse through folders on disk and check if a media item doesn't appear in the media library and add it?

(All plugins disabled) I have some strange issues with the media library. It's an old site that I have been managing for the last 2 years. The site has dated media folders on disk going back to /2010/01/.

The dropdown in media library to filter items by date only goes back to June 2013. If I select that date it shows two images. However if I look on disk there are about 70 images (not including other sizes).

I ran the following query in PMA as a routine:

BEGIN
    SELECT meta_value AS filename
    FROM wp_posts p
    JOIN wp_postmeta pm ON p.id = pm.post_id
    WHERE p.post_type = 'attachment' AND pm.meta_key = '_wp_attached_file'
    INTO OUTFILE '/tmp/filenames.log' 
    LINES TERMINATED BY '\n';
END

Which gave me file paths from 2010 but, for example, in 2010/01 it only returned one image path when there are actually 7 images on disk in that folder.

Is there something, code or plugin, that will recurse through folders on disk and check if a media item doesn't appear in the media library and add it?

Share Improve this question asked Dec 10, 2023 at 8:27 essexboyraceressexboyracer 1237 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

What you need is a way to scan your uploads directory and register any unregistered files. There are plugins that can help with this. One such plugin is "Add From Server". This allows you to import media and files into the WordPress uploads manager from the server's file system. Using this plugin, you can import those files from your disk into the WordPress database, which should make them appear in the Media Library.

本文标签: imagesMedia Library Issues