Title: Custom Plugin (mu-plugins) Issue
Last modified: November 23, 2022

---

# Custom Plugin (mu-plugins) Issue

 *  [hemasusi](https://wordpress.org/support/users/hemasusi/)
 * (@hemasusi)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/custom-plugin-mu-plugins-coding/)
 * Hi,
 * We have one custom plugin page. That page file path is – wp-content\mu-plugins\
   custom_api_logs_list.php
 * We wrote the coding to list all our API logs from database logs table and list
   in the table format – look here – [https://prnt.sc/Swje1VdgkVDh](https://prnt.sc/Swje1VdgkVDh)
 * This page file having code to get data from logs table with offset & limit. But
   facing the slow php error in php slow log – [https://prnt.sc/91W0Y-nAtv8r](https://prnt.sc/91W0Y-nAtv8r)
   
   and please see other errors also in the screenshot. Due to the error, the page
   is not loading, its taking long time and display timeout error ‘The application
   did not respond in time’.
 * Here is some screenshot from coding –
    [https://prnt.sc/WZhGktRewP3X](https://prnt.sc/WZhGktRewP3X)
   [https://prnt.sc/rtcaMBwU2ME4](https://prnt.sc/rtcaMBwU2ME4) [https://prnt.sc/OlaBSDQ6d7cX](https://prnt.sc/OlaBSDQ6d7cX)
   [https://prnt.sc/LkGFGEf1ayvO](https://prnt.sc/LkGFGEf1ayvO)
 * 1. If I try print_r or echo before get_var() query, everything is working, no
   slow in the page. But get_var only not working. All other remaining is working.
   
   2. I tried get_results() instead of get_var() but thats also triggered error &
   not loading
 * Its happened in WP 6.0.2 only i think.. Bcz before in old version, we didn’t 
   face this issue.
 * Can anyone please help.
    -  This topic was modified 3 years, 6 months ago by [hemasusi](https://wordpress.org/support/users/hemasusi/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcustom-plugin-mu-plugins-coding%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 15 replies - 1 through 15 (of 19 total)

1 [2](https://wordpress.org/support/topic/custom-plugin-mu-plugins-coding/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/custom-plugin-mu-plugins-coding/page/2/?output_format=md)

 *  [Seba Ocano](https://wordpress.org/support/users/sebaocano/)
 * (@sebaocano)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/custom-plugin-mu-plugins-coding/#post-16231612)
 * I have checked your screenshots and you have 16K records, maybe your query is
   not correctly optimized and that is what is generating the slow performance and
   timeout error.
 * I suggest you to try to make a backup, and delete some records and check if problem
   persist, you should optimize.
 *  Thread Starter [hemasusi](https://wordpress.org/support/users/hemasusi/)
 * (@hemasusi)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/custom-plugin-mu-plugins-coding/#post-16231619)
 * Hi,
 * Yes, 16K records in staging/test site. But i rewrite the query with where condition
   to get only leass number of records (for ex, only one month or one date logs)
   that’s also creates the slow log error and showing timeout error.
 *  [Seba Ocano](https://wordpress.org/support/users/sebaocano/)
 * (@sebaocano)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/custom-plugin-mu-plugins-coding/#post-16231660)
 * are you using InnoDB as storage engine on log table?
 * As I researched, in this case is best to use MyISAM, because it stores the row
   count and don’t have to count every time that you do a query like InnoDB does.
 *  Thread Starter [hemasusi](https://wordpress.org/support/users/hemasusi/)
 * (@hemasusi)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/custom-plugin-mu-plugins-coding/#post-16231662)
 * We are using MariaDB. And for your info, as you see in the screenshot we put 
   limit and offset when fetch the data from log table.
 *  [Seba Ocano](https://wordpress.org/support/users/sebaocano/)
 * (@sebaocano)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/custom-plugin-mu-plugins-coding/#post-16231731)
 * I mean the table, you can check in phpmyadmin, clic on the table and then go 
   to operations, on the “table options” you can see what you are using:
 * here is a screenshot of a table that uses InnoDB (it will not have good performance),
   can you try change it to MYISAM
 * > [View post on imgur.com](https://imgur.com/JninV1F)
    -  This reply was modified 3 years, 6 months ago by [Seba Ocano](https://wordpress.org/support/users/sebaocano/).
      Reason: wrong image link
 *  [Seba Ocano](https://wordpress.org/support/users/sebaocano/)
 * (@sebaocano)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/custom-plugin-mu-plugins-coding/#post-16231737)
 * I think this COUNT(*) could be generating the slow performace:
 * [https://prnt.sc/rtcaMBwU2ME4](https://prnt.sc/rtcaMBwU2ME4)
 *  Thread Starter [hemasusi](https://wordpress.org/support/users/hemasusi/)
 * (@hemasusi)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/custom-plugin-mu-plugins-coding/#post-16233154)
 * Hi,
 * We can’t change the Innodb, its a server thing.
    I think this COUNT(*) could 
   be generating the slow performace – I tried removing the count, just written 
   the select * but it also create the slow log for get_var
 *  [Seba Ocano](https://wordpress.org/support/users/sebaocano/)
 * (@sebaocano)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/custom-plugin-mu-plugins-coding/#post-16234583)
 * too bad you can not change to Innodb,
 * just to be sure, can you return a number value instead of doing the count(*) 
   here [https://prnt.sc/rtcaMBwU2ME4](https://prnt.sc/rtcaMBwU2ME4) ?
 * lets say 15000 and check, if it still not works well we can keep checkign the
   rest of the code.
 *  Thread Starter [hemasusi](https://wordpress.org/support/users/hemasusi/)
 * (@hemasusi)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/custom-plugin-mu-plugins-coding/#post-16234645)
 * Hi,
 * I used get_results(select query), and gets the number value using num_rows.
    
   Even the same slow error for get_results as get_var.
 *  [Seba Ocano](https://wordpress.org/support/users/sebaocano/)
 * (@sebaocano)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/custom-plugin-mu-plugins-coding/#post-16234707)
 * Mmm, I think I was not clear, I mean not query at all and just use an arbitrary
   value. If doing this works with good performance we will now that this query 
   is causing the problems
 *  Thread Starter [hemasusi](https://wordpress.org/support/users/hemasusi/)
 * (@hemasusi)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/custom-plugin-mu-plugins-coding/#post-16234719)
 * Okay, i will try to set the static value for this record_count & let you know.
 *  Thread Starter [hemasusi](https://wordpress.org/support/users/hemasusi/)
 * (@hemasusi)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/custom-plugin-mu-plugins-coding/#post-16234790)
 * Hi,
 * I tried to remove the record_count function and write default count for that 
   variable. It removes the error, but showing another error for get_results()
    
   [https://prnt.sc/6o-3rg9m3dtk](https://prnt.sc/6o-3rg9m3dtk) [https://prnt.sc/EYieP0c7ZmCX](https://prnt.sc/EYieP0c7ZmCX)
   [https://prnt.sc/xFt8LlwYZ0sS](https://prnt.sc/xFt8LlwYZ0sS)
 *  [Seba Ocano](https://wordpress.org/support/users/sebaocano/)
 * (@sebaocano)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/custom-plugin-mu-plugins-coding/#post-16234852)
 * Mmm, there is no error detail, maybe you can check another log?
 * if not, can you print the $sql variable and try to executed on phpmyadmin to 
   receive a more detailed error?
    -  This reply was modified 3 years, 6 months ago by [Seba Ocano](https://wordpress.org/support/users/sebaocano/).
 *  Thread Starter [hemasusi](https://wordpress.org/support/users/hemasusi/)
 * (@hemasusi)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/custom-plugin-mu-plugins-coding/#post-16236797)
 * Hi,
 * Yes i tried printing the $sql it gives a query. It fetching the data when i execute
   the same query in phpmyadmin/mysql. But the get_results only causing error and
   not giving the result..
 * There is no detailed error file i think. I will check with the server team.
 *  [Seba Ocano](https://wordpress.org/support/users/sebaocano/)
 * (@sebaocano)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/custom-plugin-mu-plugins-coding/#post-16236823)
 * Hi [@hemasusi](https://wordpress.org/support/users/hemasusi/), what about enabling
   debug mode on the wp-config file ?

Viewing 15 replies - 1 through 15 (of 19 total)

1 [2](https://wordpress.org/support/topic/custom-plugin-mu-plugins-coding/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/custom-plugin-mu-plugins-coding/page/2/?output_format=md)

The topic ‘Custom Plugin (mu-plugins) Issue’ is closed to new replies.

## Tags

 * [fatal+error](https://wordpress.org/support/topic-tag/fatalerror/)
 * [get_results](https://wordpress.org/support/topic-tag/get_results/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 22 replies
 * 2 participants
 * Last reply from: [Seba Ocano](https://wordpress.org/support/users/sebaocano/)
 * Last activity: [3 years, 6 months ago](https://wordpress.org/support/topic/custom-plugin-mu-plugins-coding/page/2/#post-16243950)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
