Rewrite rules modify a web URL's appearance. This modification is called URL rewriting. Rewritten URLs (sometimes known as short, fancy URLs, search engine friendly - SEF URLs, or slugs) are used to provide shorter and more relevant-looking links to web pages. The technique adds a layer of ...

learn more… | top users | synonyms

1
vote
1answer
252 views

Why doesn't flush_rewrite_rules run on plugin activation?

I'm trying to flush rewrite rules in a plugin and it isn't working. I have to go to permalinks -> save in the admin panel for the rewrites to flush. Can anyone see why? class SpektrixPlugin { public ...
0
votes
1answer
49 views

Rewrite rules goes away

I have a strange issue. The custom rewrite rules are registered correctly in my plugin activation hook. But, if I go to the permalinks settings page and clic on "Save changes" I lost the rewrite rules ...
0
votes
0answers
64 views

Rewrite author_name

I need to rewrite author_name to cat. I searched for hours but can't find anything. I restrict the search results by author instead category because of the performance, it's much faster. For getting ...
0
votes
2answers
325 views

WordPress Rewrite rule is not working

I am trying to create a rewrite rule for one of my custom page and here is the rewrite rule function add_my_rule() { global $wp; $wp->add_query_var('name_state'); ...
0
votes
0answers
617 views

Adding rewrite rules to Custom Post-type mixed with Taxonomy

I turn to you because I can not find any solution to my problem. I created 3 custom post types "Actualités", "Dossiers", "Vidéos" (I'm french :D) I created 1 taxonomy: "Thématiques" with the ...
2
votes
2answers
85 views

When is it a good idea to build a permalink structure from scratch?

Is it a good idea to design a permalink structure from scratch? The requirements to the structure are as follows: Pages to be referenced by their structure ...
2
votes
1answer
119 views

Regex in add_rewrite_tag not accepting OR operators?

I am trying to add a custom field to the post permalinks by using a combo of add_rewrite_tag and applying a post_link filter. What I am aiming for is something like this: ...
1
vote
0answers
34 views

Specific routing for CPT

I'm developing site for art gallery. A have Artist CPT (internal name artsin_artist) which is defined in my functions.php like following: register_post_type('artsin_artist', array( 'labels' => ...
0
votes
1answer
119 views

custom post type archive page has 404 error even though has_archive is true

I have an existing site that has a custom post type with no archive. It has been live for almost a year now. I am trying to change the custom post type to have an archive now. So I changed ...
0
votes
1answer
90 views

What is the proper way implement a global $wp_rewrite?

The below code works correctly, but I don't know if it is proper coding. Can anyone confirm or comment on the code? add_action('init', 'news_rewrite'); function news_rewrite() { global ...
-1
votes
2answers
187 views

Custom url rewriting

I am struggling to create custom rewrite rules for wordpress. This is my url structure http://domain/cityprofile/?city=Sydney where city profile is a page template. Now i want to make this url ...
0
votes
1answer
68 views

rewrite rules add a folder in the path

I have to do some url rewritting for custom post types. I have 2 custom post types: portfolios and locations. What I need to change is the url like this: current: ...
1
vote
2answers
82 views

Wordpress Rewrite

I'm trying to get http://example.com/site/vendors/?u=abc to rewrite to http://example.com/site/vendors/abc but I can't for the life of me figure out how to get the url rewrites to work. /site/ is the ...
0
votes
0answers
57 views

Custom Rewrite for Profiles

I'm currently trying to modify my rewrites to allow for an additional URL segment e.g. http://example.com/vendors/username/ by default WP allows for additional numeric segments but everything else ...
0
votes
1answer
54 views

Wordpress Custom Rewrite Rule

I have a custom page template to use for a wordpress page. I am trying to setup a custom rewrite rule but without success. I have a page at blog/book-page/, the display of this page depends on the ...
1
vote
1answer
219 views

Remove rewrite rules generated by plugin during deactivation‎

I have a simple plugin like the following add_action('generate_rewrite_rules', function ($wp_rewrite) { $wp_rewrite->rules = xxx + $wp_rewrite->rules; }); if (is_admin()) { ...
1
vote
0answers
118 views

Rewrites with hierarchical taxonomies in permalink

I am attempting to create a hierarchical list of products in WordPress 3.5.1. For example if the custom post type product was in the custom taxonomy Outdoor > Garden Tools > Hoses, these would ...
4
votes
2answers
507 views

Rewrite url for custom post type

I'm using WPML plugin to translate my site. I have a custom post type called "vinos" and I use this args: $args = array( 'labels' => $labels, 'hierarchical' => false, ...
1
vote
1answer
208 views

Pre-Populate $wp_query settings with custom rewrite rules and custom template_redirect

I'm currently working on a file browser plugin which requires frontend editing capabilities for a registered user. For this scenario, I have registered some custom rewrite rules for my custom post ...
0
votes
0answers
63 views

htaccess problem not being able to overwrite previous rules

so guys, what i need to do is: whenever someone ask for this url: dev.site.com/noticias/id/tittle-for-the-news ( dev.site.com/noticias/([0-9]+)/([A-Za-z0-9-]+)/ ) it needs to get this: ...
0
votes
1answer
53 views

Rewriting WordPress URLs

I've got a plugin which takes input through a GET request via a shortcode. The shortcode is placed on a page with the address /search, and the query used to execute this particular piece of the search ...
0
votes
1answer
115 views

Rewrites rules disappear after a while

My Plugin I implemented a small plugin to be able to show events with a specific custom field in a special order. To have some nice permalinks I also used the add_rewrite_rule function to add those ...
1
vote
1answer
292 views

Adding paged query to custom URL rewrite

I have set up the following to create 'pretty' post type and category permalinks: function kdev_add_category_rules() { $post_types = array( 'kdev_photos', 'kdev_videos', ...
0
votes
1answer
388 views

Redirect URL to an existing page with query string or #! added on

I'm trying to make a photo gallery where the individual photos can be shared on Facebook and Twitter, and when you click the link, the photo that was shared will open in a lightbox automatically. ...
0
votes
1answer
309 views

Access $_POST data after redirect

How can I access $_POST data after a page redirect? I guess there is some way to tell WordPress to pass all $_POST data to the redirected address, like it does with $_GET data, using Rewrite Rules, ...
1
vote
1answer
434 views

Wordpress Rewrites - How can I pass a variable to Custom Post Type?

I'm looking for a wordpress rewrite that will let me pass a query var. I have a custom post type that produces urls like this: example.com/custom-post-slug/custom-post-title/ my goal is to have ...
5
votes
1answer
388 views

CPT Template Not Showing - Getting 404

I'm developing a Custom Post Type plugin, which works fine in dev. Now that I've moved it to production, I'm getting a 404 when I try to display the template for the CPT. So, two questions: 1- Is ...
0
votes
1answer
184 views

Per Page Permalink Structure for Page Post Type

I am trying to Re-Write Page URL's so that they END with .htm I was able to do this using... /* Add .htm extension to Page URL Links */ add_action('init', 'htm_page_permalink', -1); function ...
0
votes
0answers
217 views

permalink and add_rewrite_rule - error 404

I'd like to have comments in a separate page with a dedicated template only for posts in a specific category (slug shops). Example: mysite.com/post-incatshops --> mysite.com/post-incatshops/comment ...
0
votes
0answers
86 views

standard post with extra parameter brings permalink problem

This problem concerns several rewrite rules, but i'll stick to one, for clarity. In my theme, i use a parameter "parentid" which gives me the page/post/custom post i've clicked on (the parent). in ...
0
votes
1answer
56 views

Custom Rewrite Problem

I'm creating some custom rewrites using the code below. Everything works fine, as far as urls such as this: example.com/reviews/showname Tells my theme to use the special archive page and passes ...
0
votes
1answer
215 views

Wordpress in “Couch Mode”?

I am trying to setup a "Couch Mode" (distraction free reading) on my WordPress blog as laid out in this article. The guide in the article follows these steps: Create a new page in WordPress with ...
3
votes
3answers
283 views

rewrite_rule() not preserving the query string

We have added a custom rewrite_rule to our site to allow for a pretty inbound link to be parsed and handled properly. Links are constructed as domain.com/meetings/faculty/someIDnumber add_action( ...
0
votes
1answer
159 views

Rewrite and replace url wp-admin/edit.php and wp-admin/post-new.php

everybody I want to rewrite and replace all url mydomain.com/wp-admin/edit.php -> mydomain.com/wp-admin/edit/ and mydomain.com/wp-admin/post-new.php -> mydomain.com/wp-admin/addnewpost/ How i ...
0
votes
2answers
146 views

Paginate yearly archives for a custom post type

Here's the code I'm using to create yearly archives for a custom post type: function myquery_custom_post_rewrite( $rewrite_rules ) { $myqueryslug = 'customposttype'; $month_archive = array( ...
1
vote
1answer
154 views

Custom Rewrite Rules

I am developing a plugin, the goal of which is to allow for a bookmark-able, pretty permalink search engine on a single page. To do so, I am using WP's rewrite rules to allow for the ...
1
vote
0answers
188 views

Help with multisite redirect issues using Cherokee OR solid nginx config?

A little background: We've decided to abandon Apache because it can't keep up with the demand we're putting on it. We have a cron script that will create a new post about once every 3 or 4 seconds ...
0
votes
2answers
1k views

nginx + W3 Total Cache: rewrite rules issue [closed]

nginx 1.2.7 + WP 3.5.1 + W3TC 0.9.2.8. Rewrite rules generated by the plugin simply don't work, server returns 404 after including them in nginx server config. Or maybe I'm doing something wrong? ...
0
votes
2answers
135 views

Redirect taxonomy to custom template to list terms in taxonomy

I'm trying to adapt some code on calling a custom template via rewrite rule. I have a custom taxonomy called "state". I want to create an archive for the taxonomy, that lists all the terms in that ...
0
votes
2answers
95 views

Custom rewrites for pages and categories

I am trying to understand how can create custom rewrites for pages/categories. Ex i have example.com/?page_id=178 and for this page have a contact form and i want this: %slug%.php ...
1
vote
2answers
320 views

Custom post type paging 404 error

I've an issue on custom post type, I've create a custom post type called "Agenda" and the rewrite url for http://example.com/agenda it works correctly, it points to the archive-agenda.php template ...
0
votes
1answer
64 views

Wordpress Rewrite Rule

I have a standard page setup at http://mysite.com/mypage/ I'd like to setup a rewrite rule in my theme functions that takes any URLs such as: http://mysite.com/mypage/helloworld/ <-- Currently ...
0
votes
1answer
60 views

Rewrite rule help for gallery plugin

I am writing a basic gallery plugin for WordPress. In the plugin users can mark images as favorites and there is a page where users can see their favorites. I want to setup some rewrite rules for the ...
0
votes
2answers
62 views

Remove .htaccess portion upon plugin deactivation?

I have a plugin that inserts some rewrite rule in the .htaccess file. However, upon deactivating it, doesn't remove said rule. The rule is nested in # BEGIN My plugin and # END My plugin. I want to ...
2
votes
1answer
226 views

Custom taxonomy on permalink

I have a long time problem and look forward for your help. I have a custom taxonomy of "city" (it is no hierarchical like tags). I just would like my URLs to look like this: ...
1
vote
3answers
548 views

Pagination: /tags/tag_name/?paged=2 gives a 404 error

I need to paginate an archive page. Pagination works perfectly fine for everything except tag/category archives. Basically if I use /tags/tag_name/?paged=2 it gives me a 404 error. But if I use ...
0
votes
1answer
84 views

Rewrite URL variable to custom path

I am passing to my url some variables to display latest posts, most viewed etc. http://website.com/?r_sortby=highest_rated I am wondering how to create a custom path for it instead for SEO purpose ...
0
votes
1answer
272 views

Custom page template query_vars

I created a custom page template movie-page.php and a page movie in WP. The template shows fine when I visit site.com/movie/ I want to add movie_id as a query var. Here's my code: ...
0
votes
1answer
135 views

Append custom parameter to taxonomy/term URI

I have a Custom Post Type named "Cars" and 2 Custom Taxonomies "Ferrari" and "Lamborghini". Each taxonomy has 2 Terms: "New" and "Used". These URIs work as expected: http://myhost/ferrari/new ...
0
votes
1answer
125 views

How to Add Rewrite Ruled Argument Into Permalink Properly

I am using WP rewrite rules for my custem arguments, But when I am trying to generate permalink like this: add_query_arg(array( 'type' => 'foo', 'paged' => 2, ),get_permalink($id)) ; ...