• Hello,
    I am using the metabox to upload multiple images. When I click to new post, it automatically is using the images of the ‘Media’ no I have chosen.
    Every new post it loads all images of ‘Media’.
    Have any setting should I do so that it does not automatically load the images?

    add_filter( 'rwmb_meta_boxes', 'sizy_post_metaboxes' );
    function sizy_post_metaboxes( $meta_boxes ) {
      global $text_domain;
      $prefix = 'sz_post_';
      $meta_boxes[] = array(
        'title'  => __( 'Informações', $text_domain ),
        'post_types'  => 'post',
        'priority' => 'high',
        'fields' => array(
          array(
            'id' => $prefix . 'local',
            'type' => 'text',
            'name' => __( 'Local do evento', $text_domain )
          ),
          array(
            'id' => $prefix . 'photo',
            'name' => __( 'Imagens', $text_domain ),
            'type' => 'image_upload',
            'force_delete'     => false
          ),
        )
      );
      return $meta_boxes;
    }

    https://wordpress.org/plugins/meta-box/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter John W. M. Carneiro

    (@johnwmcarneiro)

    Hello,
    In PHP 5.6 is giving problems, set up to version 5.5 and it worked normally.
    But I found the problem, the plugin makes a query_attachments request to admin-ajax.php informing the draft ID instead of WordPress return empty it returns all images. I checked the file wp-admin / includes / ajax-actions.php on line 2363 “$ query = array_intersect_key ($ query, array_flip ($ keys))”, PHP 5.6 does not include the post__in for some reason, and just returning all images.
    I do not know if it’s correct, but I think it could verify that it is indeed necessary to request the images when the post is still in draft.

    Plugin Contributor Manny Fleurmond

    (@funkatronic)

    Can you update the latest version of the plugin on github and see if the issue is fixed?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Images are automatically loaded’ is closed to new replies.