WordPress.org

Ready to get started?Download WordPress

Forums

Media upload. refresh after upload? (1 post)

  1. Webkungen
    Member
    Posted 10 months ago #

    Hi,

    I'm writing a plugin where I save some custom meta data for the uploaded images. The problem is when an image is uploaded, I have to reload the page and open the media upload again in order to see my newly uploaded images.

    I've got this hook to list only related images for the current page, when the media upload opens:

    add_action( 'pre_get_posts', 'get_oject_images' );
    function get_oject_images($query){
    	global $_POST;
    
    	$query->set('meta_key', '_ObjectNo');
    	$query->set('meta_value', $_POST['query']['ObjectNo']);
    }

    The meta data is saved on my uploaded images, but the media upload won't show them until I reload the page. Any ideas? Thanks,

Reply

You must log in to post.

About this Topic