Similar Posts
Extending password protected posts with name and email
ByeminoIf you want to add name email or any additional fields in addition to password for protected posts, see the steps below: /****************** custom protected post form *****/ add_filter( ‘the_password_form’, ‘custom_password_form’ ); function custom_password_form() { global $post; $label = ‘pwbox-‘.( empty( $post->ID ) ? rand() : $post->ID ); $a = ‘<div class=”clearfix”><form id=”password_form” class=”protected-post-form” action=”‘…
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….
The server quit without updating PID file and all that jazz.
ByeminoThe story: I was getting session file write errors (write failed: No space left on device (28) ) in wp admin, i checked /tmp folder but it was not full, only 60% percent was used. So not being able to pinpoint what the problem was, i thought a reboot would be a good idea. But…
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 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…
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())…