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.
How to get random tags in wordpress
ByeminoI needed a placeholder for tags input but it’s boring to display the same tags every time. But unlike posts, WP doesnt have “rand” orderby paramater. So what you can do; is to get a #no of tags and shuffle them. So basically what we do is: Check if we have a recent transient If…
Fastest way to get a random post link in wp
ByeminoPreviously we have established that the fastest way to get an ID is using wpdb . So, simply to get a random post link use: function eo_get_a_rand_postlink() { global $wpdb; $rand_post_id = $wpdb->get_var(“SELECT ID FROM $wpdb->posts WHERE post_status = ‘publish’ AND post_type = ‘post’ ORDER BY RAND() LIMIT 1”); return get_permalink($rand_post_id); }
Do not create accounts with these names
ByeminoCommon names are priority targets for brute force attacks. Avoid creating email and account names including words listed below. The data has been collected from a vast number of attempts, chosen the most frequent ones, plus some random sampling. Ironically, pretty sure these keywords will only attract more spam, but I hope it helps someone….
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…
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…