Similar Posts
This site is optimized with the Yoast WordPress
ByeminoIf you have a comment in your <head> that says <!– This site is optimized with the Yoast WordPress –> it’s not a big deal for the average user, but if you do not want to openly reveal that you are using WordPress, this is utterly annoying for you. I usually use my own functions…
WP nav menu disappears on category page
ByeminoMy navigation menu started disappearing on category pages. First I suspected there was something with the header or menu location, I have double, triple checked everything and I was pulling my hair out trying to find a solution. Turns out, my attempt to order posts by a custom field interfered with the menu. if( ! $query->is_main_query())…
get_plugin_data() only in admin ? Why ?
ByeminoIt provides crucial plugin info and many pointers. Like plugin folder, plugins name, plugins main file . More importantly, it could help you with a global unique_slug. More on this, and get_file_data() workaround later…
WordPress menu limit
ByeminoSo I wasn’t able to add new items to wordpress menu and found out that the reason is the POST limit but adding max_input_vars = 2000 did not solve the problem (default is 1000). If you have suhosin and cant add new menu items or save your menu, you have to add the below to your…
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); }
Fastest way to get 1 post->ID in WordPress
ByeminoSo all you need is a post->ID whats the fastest way to get it ? 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 $wpdb > wp_query > get_posts > query_posts, meaning; you should almost never ever use query_posts. And usually between the…