Solution 1 :

You can use LIMIT clause to limit the data querying. Or implement something similar to Pagination.

You can:

  • Query the results in with a Limit.
  • And add a button to query the next set of results from the last id of previous query.

Problem :

I am getting the following message

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried
to allocate 528384 bytes) in
/home/u234536193/domains/monetizingonline.com/public_html/wp-includes/wp-db.php
on line 2024

The code on line 2024 is:

$this->result = mysqli_query( $this->dbh, $query );

How to resolve the issue?

Comments

Comment posted by Dharman

You need to fetch less data. e.g. use

Comment posted by Von

I am fairly new to wordpress – What part of the code would you need?

Comment posted by GetSet

OP was here before but deleted his previous post, it appears. OP does not have original source but instead code generated from some theme site, I forget the name of which now. OP should have lead with that information here but since he didn’t, I am doing the FYI.

Comment posted by GetSet

I should also add, OP’s previous post was “closed” by moderator due to not having enough debugging details and no posted code.

Comment posted by Von

I have increase the memory limit to 512mb as a temporary fix and it was working fine. But now again I am getting – Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 548864 bytes) in /home/u234536193/domains/monetizingonline.com/public_html/wp-includes/wp-db.php on line 1989 the code in line 1989 is – while ( $row = mysqli_fetch_object( $this->result ) ) { I am fairly new to wordpress too, any simplified suggestions?

Comment posted by Von

If I limit the data query will that affect the fuctionality of the site i.e will I not keep getting the fatal error?

By