Add files to Media Gallery as much as it needed
Adds all loaded files but on edit page after saving post, there are only as many elements as saved in the 'post_per_page' settings.
I checked it in two diffrent wordpress instalations.
In fact, after saving post, items of media gallery is correctly passed to page view.
After saving post, if we do not add any more files and save it again there will be only two items, also on page view.
It looks like the same problem what I described here - https://github.com/htmlburger/carbon-fields/issues/665
I have a problem with this too. If after adding images more than posts_per_page setting and then updating, all images will still be visible, but if I reload the page the images that are visible only as much as posts_per_page
Hey. I fixed it this way:
add_filter( 'ajax_query_attachments_args', function ( $query ) {
if ( isset( $query['post__in'] ) && is_array( $query['post__in'] ) ) {
$query['posts_per_page'] = count( $query['post__in'] );
}
return $query;
} );
This has been fixed.
Please update to the latest version.
Most helpful comment
Hey. I fixed it this way: