New answers tagged

1

It is because you're using a reserved term "year". https://codex.wordpress.org/Reserved_Terms


0

The question isn't very clear to me but i'll attempt to answer anyway, forgive me if it's obvious to you: What you describe is the behavior of "custom post types" When you create custom post types you define a slug like your "suburl" and "suburl2" and all posts created under that type fall under site.com/suburl/post-title I'm sure that if you first create ...


0

It works for me. add_filter('post_link', 'locale_permalink', 10, 3); add_filter('post_type_link', 'locale_permalink', 10, 3); function locale_permalink($permalink, $post_id, $leavename) { if (strpos($permalink, '%category_slider%') === FALSE) return $permalink; $post = get_post($post_id); if (!$post) return $permalink; if ($post->post_type != '...


2

WordPress runs slugs through its sanitize_title_with_dashes() filter function which replaces dots with dashes. Unfortunately the function doesn't give you any control over that or any ability to change what characters are stripped or replaced. What we can do however is remove that filter and add our own version of it with a couple of modifications: ...


0

you can have something like this for array based. add_action('init', 'category_rewrite'); function category_rewrite() { global $wp_rewrite; $my_URL = $_SERVER['REDIRECT_URL']; // in my example i am testing http://localhost/news-events/2015 // Let save the second value $my_URL_PATH=explode('/',$my_URL); $...


0

Using the below code the following source url http://localhost/cat/<catname>/<year> will be converted to http://localhost/index.php?year=<year>&category_name=<catname> Paste the code in your there functions.php add_action('init', 'category_rewrite'); function category_rewrite() { global $wp_rewrite; $rule =...


0

WordPress will generate rewrite rules internally once you have selected a permalink format. You can do so under Settings > Permalinks in your WordPress admin area. WordPress will attempt to write to your .htaccess file. If it can't, it will provide you with some rewrite code you can copy/paste into your .htaccess file. Either way, WordPress transforms URLs ...


0

The easiest way is to use search and replace for wordpress databases Then you should do a 301 redirect the old domain to the new domain to keep visitors and indexed in Google. RewriteEngine On RewriteCond %{HTTP_HOST} !^old-domain\.com [NC] RewriteRule (.*) http://new-domain.com/$1 [R=301,L] I hope I've helped you with my answer.


0

While changing the Site URL under Settings -> General will change the website URL, it will also break the site. You should download the Search and replace tool, copy it on your webserver, run it and follow the on-screen instruction. The script will modify all the links in your db to reflect the domain change.


0

Have you tried editing your wp-config.php? If not, try to add or replace this value : // DOMAIN & URL define('PROTOCOL', 'http://'); define('DOMAIN_NAME', 'domain.tld'); define('WP_SITEURL', PROTOCOL . DOMAIN_NAME); define('PATH_TO_WP', '/'); // if your WordPress is in a subdirectory. define('WP_HOME', WP_SITEURL . PATH_TO_WP); // ...


0

If you already own name 2 as a domain, Build your web site on it, and when you are done you can redirect from old domain to the new one. That way you gain the power of the old domain too.


0

To fix this issue, we had to add the "query variables" into the functions.php of our theme to add them to the public variables. function add_query_vars_filter($vars){ $vars[] = "subject"; $vars[] = "param"; return $vars; } add_filter('query_vars', 'add_query_vars_filter'); This allowed us to retrieve the variables' value this way. $subject = ...


0

So, I've managed to achieve a version of this by setting the "home" value in Network admin > Sites > Edit > Settings to: http://example.com/custom-word/multisite-name In my case the custom word is the unique identifier for the multisite, so I had to swap the positions of the word and the name.



Top 50 recent answers are included