Yes, use caching. But even with caching you should rethink what you are actually doing because the cache for page/2 should change every time you publish a new post which might make caching pointless depending on the amount of traffic to that page.
You should probably rethink what you are trying to achieve there, why 54 and not less? 54 images on one page is a lot and the page will be slow not only because of the HTML generation but also because fetching the images will take time.
Related Posts:
- Get the number of posts from the current page results
- get_the_title($postID) OR get_the_title()?
- WP Pagination on Posts Search Results Page resulting from AJAX WP Query
- Five posts from a category in footer
- Slow page loads due to WordPress Core Query
- How to increase load time of an archive/search page (WP_Query)
- Paginate pages with dynamic query
- filter posts by meta key with pagination
- Trouble Making WP_Query paged
- Performance concerns: index.php vs taxonomy-$taxonomy.php
- Showing the correct number of posts_per_page when avoiding the use of post__not_in
- Show number of posts AND number on current page (cannot make it work)
- When should you use WP_Query vs query_posts() vs get_posts()?
- When to use WP_query(), query_posts() and pre_get_posts
- Get post ids from WP_Query?
- Pagination when using wp_query?
- How can i retrieve default post per page value? from settings->reading. And total number of posts?
- Nested meta_query with multiple relation keys
- Find out total number of pages in global query on archive page?
- Some doubts about how the main query and the custom query works in this custom theme?
- Post_count only shows the number of results per page
- Wp get all the sub pages of the parent using wp query
- Multiple WP_Query loops with Pagination
- Pagination with custom SQL query
- How to query for most viewed posts and show top 5
- WordPress Pagination Not Working – Always Showing First Pages Content
- WP Query where title begins with a specific letter
- WP_Query vs get_posts
- get_query_var function not working at all
- get_query_var( ‘paged’ ) not working outside of homepage
- Pagination on a WP_query not showing navigation links
- Different ‘posts_per_page’ setting for first, and rest of the paginated pages?
- How to paginate wordpress [gallery] shortcode?
- Pagination returns 404 after page 20
- paginate_links() adds empty href to first page and previous link
- Using OR conditions in meta_query for query_posts argument
- Custom post type archive 404’s with paginate_links
- Query Posts in a Predefined Order
- paginate_links ignore my format
- Differences Between WP_Query() and get_posts() for Querying Posts?
- Custom Taxonomy not working with posts_per_page in new WP_query (pagination problem)
- Order posts by ID in the given order
- Combining two wordpress queries with pagination is not working
- Should I use Transients with W3 Total Cache APC Caching? [closed]
- What is the most efficient way of querying posts based on visits and date for current day?
- Custom WP_Query order by post_meta and (author) user_meta
- Query Multiple Post types each with own meta query
- Is it true $wpdb->get_results is faster than WP_Query in most cases?
- How to paginate attachments in a secondary query as gallery?
- Get posts by menu ID
- Pagination with WP_Query is buggy – working for some pages, but not the others
- WP_Query and Pagination on a Static front page
- WordPress Custom Query to show posts from last x years
- next_posts_link not working for loop called with ajax
- Query causing load because of SQL_CALC_FOUND_ROWS post counting?
- Slow SQL_CALC_FOUND_ROWS Query
- Query Custom Meta Value with Increment
- Why does pagination always break when used on any form of a home page?
- How to know which one is the main query?
- Get posts by meta data OR title
- Pagination with 5 posts per page
- Pagination shows 404 after a certain number of pages
- Pagination custom query
- Perform query with meta_value date
- Using is_main_query to select custom post type on certain page
- WP_Query ordered by custom field that is a date string?
- get query’s query string
- Meta Query with date and time on the same Day before given time
- Display Posts by modifying the where clause only for my query
- Pagination not working for Custom search form & custom result template
- Pagination/infinite scroll with WP_Query and multiple loops
- How to adjust found_posts so that it accounts for offset and pagination
- Pagination broken when merging search results with additional WP_Query
- WP_query and pagination?
- How do I create my own nested meta_query using posts_where / posts_join?
- pagenavi with merged wp_query [duplicate]
- Add and in the header while looping over custom query in page template
- Stop all SQL_CALC_FOUND_ROWS wordpress queries
- pagination doesn’t show up for custom post type
- How to use filter hook posts_join for querying taxonomy terms in posts_where?
- Pagination causes error 404 when used with front-page.php
- Best practice for multiple queries on page
- Paginated pages are showing correct content but pagination links are not
- Query with pre_get_posts to get pagination
- Pagination wont work with search results template [duplicate]
- Pagination Not working on Home Page with 2 Query
- How to Get All Posts but the Private ones?
- Best Practice For Querying Grandchildren?
- Pagination not working on static page
- ‘paged’ in wp_query doesn’t work
- Display different number of posts from one category on the different pages
- Pagination not working Search posts
- Pagination not working for category posts
- Pagination is not working using WP_Query
- WP Query with offset breaks wp_pagenavi or any pagination
- Search – Ajax – Alter Query Parameters with Pagination
- Two queries on the same page with pagination
- Transient pagination not working properly
- Injecting content with $wp_query->current_post restarts from zero on paged pages. How to inject content after X posts, regardless of pagination?
- How to query ‘posts_per_page’ to display a different blog posts index template?