WP Query crashes on more than ~ 2000 posts

Querying this many posts is dangerous and you can ( and do ) take the site down. If you absolutely have to do this, you need to adjust your query to be more performant.

If you’re just needing the link then add 'fields' => 'ids' to your params – this will only return the post ID and not the whole Post object. You can then use the ID to get the permalink, title etc.

If you’re not going to paginate, then use 'no_found_rows' => true this will stop WordPress from running expensive SQL CALC queries to get the total number of posts that the query retrieves.

You should 100% cache the results of this query using the Transient API this will allow you to return cached HTML instead of rebuilding this query every time someone hits the page.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)