I’ve been trying a few methods to slow the loading of my WordPresss installation by x seconds but I’ve had problems which each try:
- Javascript sleep() does the job but my hoster emailed me saying my website was using too much CPU and would be suspended if I didn’t remove the code
- jQuery hide()/show() on body/html does the trick, but the page flashes before disappearing, which is not my intended behavior.
The ideal solution would:
- not rely on Javascript but be PHP/Wordpress-side.
- be a pluggable functions.php code
- not show for a split second the page before making it disappear
- be invisible to the user (the whole point ot this thing is the test-user not knowing the amount of seconds, so JS code kinds of defeat the purpose being public)
Thanks for any help!
1 Answer
I don´t know why you would want to slow your website down, but PHP got sleep()
which pauses a program for the amount of seconds you pass to it.
You could then hook your function/plugin to init
to halt your WordPress before it starts its output.
That could probably do what you want. But why?