Support » Fixing WordPress » Media upload. refresh after upload?

  • 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,

  • The topic ‘Media upload. refresh after upload?’ is closed to new replies.