term_id; } else { return false; } } /** * Clean domain. * @param string $input Domain. * @return string */ function clean_domain( $input ) { $input = trim( $input, '/' ); if ( ! preg_match( '#^http(s)?://#', $input ) ) { $input = 'http://' . $input; } $url_parts = parse_url( $input ); // Remove www. $domain = preg_replace( '/^www\./', '', $url_parts['host'] ); return $domain; } // Remove inline width and height attributes from images. add_filter( 'post_thumbnail_html', 'remove_width_attribute', 10 ); add_filter( 'image_send_to_editor', 'remove_width_attribute', 10 ); /** * Remove width atribute. * * @param string $html Html. * @return string */ function remove_width_attribute( $html ) { $html = preg_replace( '/(width|height)="\d*"\s/', '', $html ); return $html; } /** * Work around pagination name ampersand bug. * * @param string $link Link. * @return string */ function workaroundpaginationampersandbug( $link ) { return str_replace( '#038;', '&', $link ); } add_filter( 'paginate_links', 'workaroundpaginationampersandbug' );