我也在寻求同样的解决办法。我将创建一个gallery filter函数-对其进行扩展。是否要协作?
function get_post_gallery( $post = 0, $html = true ) {
$galleries = get_post_galleries( $post, $html );
$gallery = reset( $galleries );
/**
* Filter the first-found post gallery.
*
* @since 3.6.0
*
* @param array $gallery The first-found post gallery.
* @param int|WP_Post $post Post ID or object.
* @param array $galleries Associative array of all found post galleries.
*/
return apply_filters( \'get_post_gallery\', $gallery, $post, $galleries );
}