Skip to content

Instantly share code, notes, and snippets.

View rtpHarry's full-sized avatar
🎯
Focusing on learning something every day

Matthew Harris rtpHarry

🎯
Focusing on learning something every day
View GitHub Profile
@rtpHarry
rtpHarry / functions.php
Last active June 5, 2025 11:57
Force All Results For Specific Archive Pages
<?php
add_action('pre_get_posts', function ($query) {
if (
!is_admin() &&
// for me I commented this out in the end as my ajax grid sort by query was going back to a smaller set of results
// but it is risky, as it could affect other parts of the site like related posts, or sidebar widgets
// test it out on your site, and if it breaks then you will need to dig in and find a way to detect which query
// to filter:
// $query->is_main_query() &&