Allowing non-latin characters in registration

Try this (not tested, I hope I am not short circuiting it into endless loop): add_filter(‘sanitize_user’, ‘non_strict_login’, 10, 3); function non_strict_login( $username, $raw_username, $strict ) { if( !$strict ) return $username; return sanitize_user(stripslashes($raw_username), false); }

Load different template file when condition met?

Can you perform the logic on the template_include filter? Else, you could set a global/constant and use that in template_include to serve up the appropriate template. The template_include filter filers the path to the template file to be included. To avoid errors you should check if the template exists – locate_template does this for theme/child-theme … Read more

Remove WPML’s home_url filter

I found that it required removing 4 filters/actions to undo WPML’s home_url modification. Since I didn’t know what else this might break, I ended up changing my site’s logo to use site_url() which in my case was the same, but not changed by WPML. function disable_things(){ remove_filter( ‘page_link’, array( $this, ‘permalink_filter’ ), 1, 2 ); … Read more

Change text of Description in Image Library

Even if is not very flexible filter you can use the gettex hook. Only be aware that this filter runs for every string being translated, so can affect performarce if over-used. To narrow the performance impact you can add it only of admin footer, and remove it just after had use it: add_action(‘admin_footer’, function() { … Read more

Alter only the page title, not the post titles within

I believe that the page title you are talking about is the title from the page from the main query. the_title() filter (and the_content() filter for that matter) targets all the respective template tags regardless of query. To avoid this, target only the main query and the specific page. You can try the following inside … Read more

add class to term_description

this does the trick <?php function add_class_to_term_description($term_description) { echo ‘<div class=”cell”>’ . $term_description. ‘</div>’; } add_filter( ‘term_description’, ‘add_class_to_term_description’ ); ?>

How to override the email function by using filters? [closed]

If Divi theme uses wp_mail() function (which most likely does), you can use the wp_mail filter to pass your own arguments to the function: function filter_divi_mail( $args ) { // Modify the options here $custom_mail = array( ‘to’ => $args[‘to’], ‘subject’ => $args[‘subject’], ‘message’ => $args[‘message’], ‘headers’ => $args[‘headers’], ‘attachments’ => $args[‘attachments’], ); // Return … Read more