WordPress redirects non-existing url to existing ones – how to disable

This question is a duplicate of Disable ONLY URL auto complete, not the whole canonical URL system Try this filter function remove_redirect_guess_404_permalink( $redirect_url ) { if ( is_404() ) return false; return $redirect_url; } add_filter( ‘redirect_canonical’, ‘remove_redirect_guess_404_permalink’ ); Or this plugin: https://wordpress.org/plugins/disable-url-autocorrect-guessing/

Pagination url canonical problem

You have to install Yoast SEO and then add to functions.php: function return_canon () { $canon_page = get_pagenum_link(1); return $canon_page; } function canon_paged() { if (is_paged()) { add_filter( ‘wpseo_canonical’, ‘return_canon’ ); } } add_filter(‘wpseo_head’,’canon_paged’);

Preserve Domain Alias

You need to set the canonical hostname (ie. with www) in the WordPress dashboard… Under Settings > General and set the appropriate “WordPress Address (URL)” and “Site Address (URL)” properties. Alternatively, these values can be hardcoded in wp_config.php by defining the WP_HOME and WP_SITEURL constants respectively. Reference: https://codex.wordpress.org/Changing_The_Site_URL SSLOptions +StrictRequire SSLRequireSSL SSLRequire %{HTTP_HOST} eq “example.com” … Read more

How to redirect URL with subfolder to the same URL but without subfolder?

Assuming you have already moved your site from the /blog subdirectory to the document root and changed the URL structure within WordPress itself, so the /blog subdirectory is not included in all your internal links, then you can either do a simple redirect (using mod_rewrite) in the /blog/.htaccess file (preferable): RewriteEngine On RewriteRule (.*) /$1 … Read more

Changing WP_Query params with url Query Var

This code manually sets the order with the ‘order’ => ‘ASC’ declaration in the WP_Query arguments. $loop = new WP_Query( array( ‘post_type’ => ‘product’, ‘meta_key’ => ‘product_price’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’, ‘posts_per_page’ => 4, ‘paged’ => $paged) ); If we want to pass a url parameter to that we could use something like: … Read more

Insert “javascript:void(0);” into URL

I also can’t stand the fact the WordPress removes “javascript:void(0);” from my hrefs (or anything else TBH…) upon saving or using the visual editor. I just started using the Raw HTML plugin that does the job. I enclosed my code in [raw] … [/raw] codes, and did NOT use the visual editor. My “voids” remain … Read more