How to fix old embeded iframes with WP-CLI search-replace

You should probably use something like regex101.com to test this before you run it on a database. You could start off with something like: wp search-replace ‘<iframe ((width|height|frameborder)=”\d+” |allowfullscreen)+?src=”https://wordpress.stackexchange.com/questions/222382/https?:\/\/www\.youtube\.com\/embed\/([a-zA-Z0-9]+?)” ((width|height|frameborder)=”\d+” |allowfullscreen)+?>\<\/iframe\>’ ‘https://www.youtu.be/$1′ –regex but I’m not 100% sure of that…

Call Shortcode Attribute Value within another function

First: You return before you add the values to the $outvalue, so this part of the code is never reached. Second: You have typos, when adding the values to $outvalue. This function works for me: function myVal($attr, $content = null) { extract(shortcode_atts(array( ‘var1’ => ”, ‘var2’ => ”, ‘var3’ => ”, ‘var4’ => ”, ‘var5’ … Read more

Redirect non www to www using redirection plugin regex

You should try changing your WordPress Site URL from Non WWW to WWW (Eg. if your site url is http://example.com then you should edit it from Setting > General > WordPress URL to http://www.example.com I think this will solve your problem.

Adding span tags to post titles using regex

It’s nice to use regex, but you can also achieve the same thing here by just splitting the string on ‘:’ with explode e.g.: $matches = explode(“:”, get_the_title()) ; if (count($matches) == 2) { $result = “foo bar $matches[0] foo bar $matches[1]”; } else { // case with no : in title $result = “foo … Read more

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