Checking if string contains numbers
is_numeric doesnt check strings for numbers. You need to use preg_match('#[0-9]#',$string)
is_numeric doesnt check strings for numbers. You need to use preg_match('#[0-9]#',$string)
There are various ways to get user_ID in WP. But which one is the fastest ? I’ve compared 3 ways function get_uid_from_global() { global $current_user; return $current_user->ID; } function get_uid_by_gcuid() { return get_current_user_id(); } function get_uid_by_wpgcu_id() { return wp_get_current_user()->ID; } Without a doubt, global method was fastest. With multiple 100,000 runs, global method took 0.9~…
I’ve been pulling my hair why my custom cursor wouldnt work. Turns out, IE (yes, big surprise) takes site url instead of stylesheet as baseurl when it comes to cursors.
Sorry, this entry is only available in English. For the sake of viewer convenience, the content is shown below in the alternative language. You may click the link to switch the active language. find $directory -type f -name “*.ext”
Actually, you do not want to open memcached port in your firewall. #ref: http://serverfault.com/questions/530051/memcached-ports-and-csf
I 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…
Always check for local time Despite the fact that my server timezone was set correctly, somehow time() was giving wrong ( UTC) hour. So i ended up using wp’s functions to make sure. $now = current_time( ‘timestamp’, 0 ) ;$local_ts = get_the_time(‘U’,$post->ID);