Query Nopaging action not having effect

nopaging does not fetch all posts, it just tells WordPress not to bother figuring out stuff like how many pages there are.

What you actually wanted was not to disable pagination, that’s just a solution to your problem that you asked about. You should ask about your problem instead, aka how to show all posts at once.

Showing all posts at once can be dangerous, so instead, set a limit that’s very high, e.g:

$query->set('posts_per_page', 500 );

Anything more than 500 posts will probably cause problems, or be extremely slow, as well as being extremely long winded. The idea being that you specify a number you never expect to reach. That way you know for a fact that the worst case scenario can’t happen. Why trust that there won’t be a broken plugin or a client who does something by accident when you can know for a fact the page won’t break?

tech