How to set up redirects for category paginated pages after adding /category/ to permalink

Add the following to your .htaccess, in between the <IfModule mod_rewrite.c>: RewriteCond %{HTTP_HOST} !^(.*)/page/$ RewriteRule ^(.*)$ /category/$1/? [R=301,L] Your default .htaccess created from WordPress should now look like the following: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # Custom … Read more

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

Store regex expression in WordPress DB using Options API

WordPress by default “escapes” all slashes and quotes in all input (historical reason, relic of the time PHP could have been configured to do it by default, or not). If you are handling forms by yourself instead of using the APIs you will need to strip the slashes, probably best to be done when saving … Read more