Media upload. refresh after upload? (1 post)

  1. Webkungen
    Posted 2 years ago #


    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,

Topic Closed

This topic has been closed to new replies.

About this Topic