Hot answers tagged

3

For this to work, you would have to add a rewrite that rewrites https://example.com/[manufacturer slug]/[brand slug] to index.php with e.g. manufacturer=[manufacturer slug]&brand=[brand slug]. e.g.: add_filter( 'rewrite_rules_array','jf_insert_rewrite_rules' ); function jf_insert_rewrite_rules( $rules ) { $newrules['^(.*)/(.*)/?$'] = 'index.php?...


2

Background Even after looking around everywhere, I couldn't find a proper solution for removing CPT slug from permalinks that actually works and is consistent with how WordPress actually parses requests. As it seems, everyone else looking for the same solution is in the same boat as me. As it turns out, this is actually a two-part solution. Remove CPT slug ...


1

The solutions here are all good but were not consistent with both local and remote server environments. So I came up with a simpler neat solution that works better regardless of the WordPress permalink settings. function getCurrentUrl() { $protocol = is_ssl() ? 'https://' : 'http://'; return ($protocol) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'...


Only top voted, non community-wiki answers of a minimum length are eligible