minidak03
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: How to Remove Comment link on Static Pages?Simple open up the wp-includes folder and look for a file called default-filters.php
Open this file and scroll down until you see a line which looks like this
add_filter(‘comment_text’, ‘make_clickable’, 9);
Remove that line and re-upload this file and like magic the links in your comments are no longer active.
Forum: Fixing WordPress
In reply to: WordPress database error: [MySQL server has gone away]I just thought I’d make my first contributions to this topic because believe me I’ve been dealing with it for two weeks straight and this is a VERY common problem, the downside for some odd reason is that the proper fix is almost impossible to find, basically what I did was find a way to fix it myself.
You see when we are building plugins for this we obviously may want our plugins to be distributed among a large amount of people so changing the wp-db.php file is just not a very smart move you see I too am using GoDaddy and the error “MySQL server has gone away” is not caused by GoDaddy and its not caused by WordPress.
Its caused by MySQL, some call it a bug but 9 times out of 10 I find that its caused because you are using WAY too many queries, for instance if you have a query inside of a loop then your asking for trouble with this error, my instance required me to have an insert statement inside of a for loop and that loop/insert statement had to run between 30 and 100 times.
Not very economical running the same query over 100 times (Different info being added each time), now what happens here is that you flood the MySQL database, it simply cannot keep up with the amount of queries your sending it so it times out and doesn’t automatically re-connect since most times the re-connect features is on your hosting account and since we don’t have access to the .ini files we have to slow down on the amount of queries being sent at any one time.
So if your running lots of queries inside of a loop try using the sleep(2); statement after you run your query, what this will do is put your code on hold for 2 full seconds after which it will continue, 2 seconds is more then enough time for the MySQL database to catch its breath and insert the information before taking on another query.
The only downfall with that is it makes your script run even longer, so if your looping through 50 or 100 times your loop is going to take about 100 to 200 seconds which is 1.5 to 2 minutes long, that is just crazy and way too long but if your not doing that many queries maybe do the calculations and if it won’t take that long then try the sleep(2); trick.
At least with this method it can be done inside of your code and you don’t have to get the end user trying to do any PHP editing because in my experince most people that use plugins don’t know how to code and asking them to make additional edits to their software usually doesn’t work out to well for the un-savvy computer user.
I’ll get back on this topic with more soon.