Skip to content

Commit

Permalink
Set a limit on get_chilrdren()
Browse files Browse the repository at this point in the history
As `get_children()` performs a no-limit query by default we should set a posts_per_page to avoid unnecessarily expensive queries.
  • Loading branch information
philipjohn committed Apr 26, 2018
1 parent 9a6d076 commit d250860
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions includes/embeds/class-amp-gallery-embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public function shortcode( $attr ) {
'order' => $atts['order'],
'orderby' => $atts['orderby'],
'fields' => 'ids',
'posts_per_page' => 100,
) );
} elseif ( ! empty( $atts['exclude'] ) ) {
$attachments = get_children( array(
Expand All @@ -73,6 +74,7 @@ public function shortcode( $attr ) {
'order' => $atts['order'],
'orderby' => $atts['orderby'],
'fields' => 'ids',
'posts_per_page' => 100,
) );
} else {
$attachments = get_children( array(
Expand Down

0 comments on commit d250860

Please sign in to comment.