Similar Posts
You can not use conditional tags on init
ByeminoQueries are only available after “wp” action hook, so ‘init’ is too early to check for it.
Fastest way to get 1 random post in WordPress
ByeminoSo all you need is simply 1 random post, 1 random post->ID or 1 post link, you dont need to go through all the hoops. (Update: added $wpdb function to tests) Jump to conclusion or lets evaluate our options here: query_posts(), get_posts(),wp_query(), $wpdb As a rule of thumb, usually we can say wp_query > get_posts…
If you need an ID just get an ID
ByeminoIf you are familiar with WordPress, you should already know that you should almost never have to use get_posts(). Your best bet is to use WP_Query . As good as wp_query is, you should still fine-tune it depending on your needs, it does make a difference. For example, if you just need 1 random post…
Optimizing WordPress query for autocomplete search
ByeminoI was working on an autocomplete solution and I was thinking of ways to speed up the search. I will be providing a few examples with results below. Q1 is the default wordpress search with no parameters. Q2 removes the caches since they wont be really necessary. And Q3 is tailored for precision; ie: my…
Apache not working after reboot, varnish unable to start
ByeminoSo I rebooted my server and everything seemed to be working, mysql, apache everything running but the websites werent loading. I could not instantly remember the cause because a machine reboot is not something you do on your server every day. The reason was I had varnish installed and it failed to start after reboot…
Using spam comments for SEO
ByeminoLong story short: BAD IDEA, don’t. It’s widely recommended to edit some of the spam comments -removing the spam url and editing comment content to something more related- and approving them in order to gain you some SEO advantage.It’s supposed to give you SEO advantage if your article has more comments (You could fake it…