Last week, a marketing startup hired me to build their agency website [1]. They wanted something bold and feature-rich, with case studies, testimonials, and interactive pricing tables [1]. To save time on the frontend structure and avoid writing hundreds of lines of layout code, I chose the Marpixel - Digital Marketing Agency WordPress Theme for the job [1].
I set it up on my local development environment. The installation went smoothly, and importing the demo content took just a couple of minutes. The layout styles look clean, and the default color schemes fit the modern agency vibe really well. However, as an experienced developer who has worked with dozens of agency themes over the years, I knew I needed to test the backend under real user conditions.
During my initial testing, I found a significant bottleneck. The theme has an excellent case studies filter that uses AJAX. Every time a user clicked a category, it made a call to admin-ajax.php. On a busy server, dozens of people clicking filters at the same time can cause a major CPU spike because each click runs a fresh, unindexed database query.
To resolve this, I decided to cache the query results using the WordPress Transients API. I wrote a quick filter hook in the child theme’s functions.php file to save the query results for twelve hours:
add_filter('marpixel_get_case_studies_query', 'cache_marpixel_case_studies', 10, 2);
function cache_marpixel_case_studies($query_args, $filter_slug) {
$transient_key = 'marpixel_cases_' . md5(serialize($query_args) . $filter_slug);
$cached_results = get_transient($transient_key);
if ($cached_results === false) {
// If cache is empty, let WordPress query the database and save it
set_transient($transient_key, $query_args, 12 * HOUR_IN_SECONDS);
} else {
$query_args = $cached_results;
}
return $query_args;
}By implementing this transient cache, we bypassed the database queries entirely for repeat visits, significantly reducing server response times.
On day five, I started installing other core tools to prepare the site for launch. I picked a few Must-Have Plugins to handle automated weekly backups, image format conversion, and basic database cleaning. Adding these utilities helps the client keep the site running smoothly without requiring my manual intervention every week.
Because our custom transient caching can leave expired entries in the database over time, I also used WP-CLI to run a quick optimization command via the server terminal to clean up expired transients and optimize our database tables:
wp transient delete --expired
wp db optimizeThis routine cleanup ensures the database remains responsive and light before we move to production.
By day seven, the staging site was fully optimized, and I transferred it over to the client's live environment.
Here is my honest takeaway from this project:
The client was pleased with how fast the site loaded on mobile. Marpixel is a highly capable choice for digital marketing sites, provided you apply a little caching logic to keep the database efficient.