WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#39974 closed defect (bug) (invalid)

Grid Mode Doesn't Load Files - Infinite Loading

Reported by: Peter Westerlund Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7.2
Component: Media Keywords:
Focuses: ui, administration Cc:
PR Number:

Description

In Admin > Media Library, files won't load when viewing in grid mode. But is showing in list mode.

  • I have tried re-installing Wordpress except /wp-content and wp-config.php. Did not helped.
  • Have activated wp_debug, but couldn't see any related errors
  • Have tried removing all the code from functions.php
  • Have tried activate another theme

Nothing is helping. I suspect something has got into the database and destroying this functionality.

A moment before this happened I were adding this code to function.php:

<?php
function save_nb_image()
{
    global $wpdb;

            $id = $_POST['id'];
            $file = wp_get_attachment_url($id);

                if ( !is_wp_error($id) )
                {
                    $meta = wp_generate_attachment_metadata($id, $file);
                    $meta = nb_image_crop($meta);
                    wp_update_attachment_metadata($id, $meta);
                }

    wp_die();
}
add_action( 'wp_ajax_nb-image-autofix', 'save_nb_image' );

And then clicking on the "Autofix" button. I have later found out that wp_get_attachment_url() wasn't the right function to use. That outputted a lot of code that I suspect is the image in code format. The right function to use is get_attached_file(). However, the Media Library Grid Mode is still not working.

Change History (4)

#1 follow-up: @blobfolio
3 years ago

It sounds like you may have corrupted the image metadata. Have you tried running a plugin like https://wordpress.org/plugins/force-regenerate-thumbnails/ to regenerate the images/meta?

#2 in reply to: ↑ 1 @Peter Westerlund
3 years ago

Replying to blobfolio:

It sounds like you may have corrupted the image metadata. Have you tried running a plugin like https://wordpress.org/plugins/force-regenerate-thumbnails/ to regenerate the images/meta?

Omg that worked! Thanks.

#3 @blobfolio
3 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Woo! No problem. I'm pretty sure I've done the same thing before. :)

#4 @SergeyBiryukov
3 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.