Alphanumeric usernames and error message for it

Check for alphanumeric For more details, look at the regex Q on SO. $name=”input string 123″; // Doesn”t allow: // Pre-/Appending white space // Not more than one space in between // Non-alphanumeric characters (lower case) if( ! preg_match( “/^[a-z0-9]+([\\s]{1}[a-z0-9]|[a-z0-9])+$/i”, $name ) ) { // Output Error Message } // Or: Does only allow // … Read more

Dynamically append custom post type to end of url

Here is something I came up with to solve this exact problem. add_action(‘wp_list_categories’,’example_wp_list_categories’); function example_wp_list_categories($output) { global $post; foreach (get_categories() as $cat) { if (preg_match(“/\/category\/$cat->slug\//”, $output)) { $output = str_replace(‘/category/’ . $cat->slug . “https://wordpress.stackexchange.com/”, ‘/category/’ . $cat->slug . ‘/?post_type=” . $post->post_type, $output); } } return $output; } Regex isn”t a strong point of mine, so … Read more

post->post_content filter

You use preg_replace function incorrectly. This function returns replaced content: add_filter( ‘the_content’, ‘wpdu_image_replace’ ); function wpdu_image_replace( $content ) { return preg_replace( ‘/<img.*?src=”https://wordpress.stackexchange.com/questions/55241/(.*?)”.*?>/’, ‘<a href=”$1″>Image file</a>’, $content ); } Also pay attention that you don’t have to use global variable $post, because content of the post is passed to your function as first argument.

Avoid too long words in a post title, post content or comment but only if its not a url

Thank you Milo, “word-break” alone wasn’t enough as it’s css3 only and not cross-browser. But I found this: .bloc_content{ overflow:hidden; -ms-word-break: break-all; word-break: break-all; word-break: break-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; } It seems to to work in all cases I tested. Hopefully it would be cross-browser enough to solve the problem. Not sure … Read more

regEx wp core file

I was able to answer my own question. Simply adding a 0-9 into the code above remedied the situation. Here is the final code: if (!name || !/^[a-z0-9][a-z0-9\-\_:\.]*$/i.test(name)) { tinyMCEPopup.alert(‘advanced_dlg.anchor_invalid’); return; }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)