Extend PHP regex to cover “srcset” and “style” attributes

I was able to use the following regex to cover all tags & attributes with protocols: /<(?:input\b[^<]*\bvalue=[\”\’]https?:\/\/|link\b[^<]*?\brel=[\’\”]canonical[\’\”][^<]*?>)(*SKIP)(*F)|https?:\/\// This is the updated section: # If ‘Relative’ option is selected, remove domain from all internal links $exceptions=”<(?:input\b[^<]*\bvalue=[\”\”]https?:\/\/|link\b[^<]*?\brel=[\’\”]canonical[\’\”][^<]*?>)(*SKIP)(*F)’; if ( $this->option == 2 ) { $website = preg_replace( ‘/https?:\/\//’, ”, home_url() ); $links = preg_replace( “https://wordpress.stackexchange.com/” . $exceptions … Read more

Remove Trailing Slash from Category Base and Tag Base

I did a lot of digging and I came up with this code to solve the problem as well as adding “.html” to pages, categories and tags. The permalink setting takes care of posts. function hpct_page_rewrite($rules) { foreach ($rules as $key => $value) { $newrules[str_replace(‘/?’, ‘.html’, $key)] = $value; } return $newrules; } function hpct_page_link($link) … Read more

wp-admin remove part of the url

I’ve searched in the admin templates. It seems the placeholders rely on the functions wp_get_referer() and wp_get_raw_referer() which use $_SERVER[“REQUEST_URI”], $_SERVER[‘HTTP_REFERER’] and a wp custom variable passed in the request : $_REQUEST[‘_wp_http_referer’]. So WordPress builds some URLs (apparently not all) on REQUEST_URI, that is /wp-admin/whatever (in the backend). The logs show that wp-admin/admin-ajax.php comes through … Read more