add_rewrite_rule() allows you to specify additional rewrite rules for WordPress. It is most commonly used in conjunction with add_rewrite_tag() (which allows WordPress to recognize custom post/get variables).

learn more… | top users | synonyms

0
votes
1answer
72 views

Wordpress permalink still not working (error or not understood?)

After hours in understanding wordpress permalinks I'm despairing and hope that somebody can help. I have the following link: www.mysite.com/?page_id=923&bahn=BER After activating the ...
1
vote
1answer
214 views

Multiple Permalinks for Same Post

I'd like to be able to have multiple permalinks for the same underlying post (for i18n reasons) - eg http://www.example.com/my-custom-post-type/this-is-a-cool-article ...
0
votes
1answer
16 views

Grab last part of the url inside rule

I have an url like this http://example.com/en/username/Pimpampum And I have one rule to map it into a search page, but I want to grab that Pimpampum inside the rule. So that I can call the search for ...
0
votes
1answer
62 views

add_rewrite_rule to search

Newbie WordPress developer here. I need to map a WordPress URL like this www.example.com/user/Username to a search result based on that Username I already have the page that makes the search with ...
0
votes
1answer
500 views

Rewrite rules not working in WordPress

I'm trying to add the new rewrite rules using the rewrite API: add_rewrite_rule('product/([A-Z0-9]{10})', 'index.php/product/?asin=$1', 'bottom'); add_rewrite_rule('product/(([A-Za-z0-9_])*)', ...
0
votes
1answer
62 views

how to exclude admin page from add_rewrite_rule in wordpress

I'm trying to add the following rewrite rules: add_rewrite_rule('([A-Za-z0-9])/([A-Za-z0-9])', 'index.php/product?subcategory=$1&product=$2', 'top'); add_rewrite_rule('([A-Za-z0-9])', ...
1
vote
1answer
178 views

How to set up Author archives with sub category URL

So i have a site where i have used the authors.php page so that i can display individual user's profile pages.. the url then looks something like: http://mydomain.com/author/test/ What i would like ...
0
votes
0answers
35 views

Rewrite rules custom post type

I created a new custom post type "video" and a new taxonomy "singers". There are 3 singers: Michael Jackson, Madonna, Eminem. I'd like change the permalink and so I'd like this URL: ...
0
votes
1answer
96 views

URL rewrite in theme doesn't seem to be working

so I was asked to create url rewrites for one of the websites we're working on, but the thing is the test rewrite I did, just to try it out, is not really working. here's the code I put in the ...
0
votes
2answers
137 views

URL Rewrite doesn't work for nested pages

I am using URL rewrite like this page: unexpected problem in url rewrite It works without any problem, but when I try to use the same rules for nested page, it doesn't work. Say, I have two pages ...
0
votes
0answers
32 views

Rewrites with options on custom post type

I have a custom post type called 'episodes'. All of my episodes have an audio file associated with them. This file is embedded automatically in the template. Some of my episodes also have a video ...
0
votes
1answer
62 views

Add custom content to nonexistent page

I am trying to add content to what would otherwise be a 404 page. For example I want to define post content for mysite.com/existing-page/imaginary-page instead of showing the 404 page. I've tried ...
0
votes
0answers
345 views

add_rewrite_rule and passing variables for custom post types

this is driving me crazy!! Scenario is... Custom post type let's call it "cpt_product" setup with the rewrite "products" Trying to use the add_rewrite_rule to create a friendly URL for meta details ...
0
votes
2answers
131 views

Plugin architecture to pull from API & create dynamic content on WP site?

I am creating a custom plugin that connects to an external API and pulls in data about a company's locations. Currently, the plugin has a shortcode that I put on a "Locations" WordPress page that ...
0
votes
1answer
123 views

Rewrite url / permalink for default archive - yearly / monthly

I want to change the structure of yearly/monthly archive URL of default post type 'post'. As we know be default the URLs are like: Default: http://wwww.domain.com/2013/09 but want them rewritten, ...
3
votes
1answer
168 views

Why does wordpress still strip my query var?

Im trying to pass a query var to a custom page template with pretty permalinks. So basically i have a page called "albums". And i want to pass a query var to that page called "type". So the ...
0
votes
0answers
77 views

add_rewrite_rule() for an unknown parent page

I am trying to get this rewrite rule to work right. What I have is a plugin that creates a page after the user inserts a page name in the settings that I created for the plugin. The users custom page ...
2
votes
1answer
109 views

Pagination problem

I have two custom rewrite rules: add_rewrite_rule('foo/bar/?', 'index.php?post_type=foo', 'top'); add_rewrite_rule('foo/bar/([a-z]+)/?', 'index.php?post_type=foo&bar=$matches[1]', 'top'); Which ...
0
votes
0answers
197 views

Passing multiple variables in wp_rewrite / wp_query

i need to be able to append a custom url for my page in wordpress so far i can get it to return the first query var, but i cannot get it to return the second or third im at a loss of what to try next, ...
0
votes
2answers
291 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
2answers
352 views

add_rewrite_rule to remove /category/ from permalink

Hi I have many permalinks across my site that looks like this: http://www.mysite.com.com/market/category/slug/slug/slug/ http://www.mysite.com.com/market/category/slug/slug/ and would like to hide ...
0
votes
0answers
123 views

Conditional add_rewrite_rule

im trying to get 'test' on add_rewrite_rule. I'have a custom post type(product) which is linked to 3 taxonomy (line, gender and type). I would like to have clean url like this ...
1
vote
0answers
160 views

Get url.com/post_type/taxonomy/term work!

I'm having trouble get what I want by mixing custom post types and taxonomy. I want to run this: www.url.com/post_type/taxonomy/term In my case this: www.url.com/dossier/theme/sante (sante is a term ...
0
votes
1answer
75 views

Why is a rewrite rule in wordpress prevent pagination?

I have a custom page that uses a rewrite rule. The "non-pagination" rewrite works fine: add_rewrite_rule( '^brand-list/([^/]*)/([^/]*)/?', ...
0
votes
1answer
286 views

Using add_rewrite_tag to create urls for page sections

I am dividing my page templates into linkable regions. I'd like to be able to use clean urls to do so. My page urls look like so www.example.com/page-name/?section=example I'd like to rewrite the ...
-1
votes
2answers
183 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 ...
1
vote
1answer
185 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()) { ...
0
votes
1answer
188 views

Localize URL bases

I run a non-English blog. I love that WordPress has been translated to Spanish and currently I use the Spanish translated version of WordPress. One thing that I'd really like to change is the URL ...
0
votes
1answer
71 views

Additional .htaccess rules based on wp page

I've created a page in the dashboard called Authors, created a new template-authors.php with completely own logic. It works well, going to website.com/authors/ I see a list of all authors, specifying ...
1
vote
0answers
555 views

URL Rewrite and add_query_var not working

I know there are several topics about URL rewriting in Wordpress but none of the topics I found helped me. I want to rewrite the URL profile/?person=abc (which works fine, but isn't pretty) to ...
0
votes
1answer
136 views

URL Rewriting in WordPress

How can I rewrite URLs on WordPress? For example, I have a URL like sitename.com/?page=<numbers>&id=<numbers> and I want to rewrite it as sitename.com/page/id/<other info>. How ...
0
votes
1answer
51 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
0answers
77 views

Display results from two Custom Post Types in page template

What I have is Created a new page with slug monuments Created a template file at my theme's folder that will show all records with post_type monument. [UPDATE] 3.I forgot to mention that each ...
0
votes
1answer
108 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 ...
2
votes
2answers
254 views

How to change the matches in add_rewrite_rule

One of the examples using add_rewrite_rule function in wordpress is add_rewrite_rule('^nutrition/([^/]*)/([^/]*)/?','index.php?page_id=12&food=$matches[1]&variety=$matches[2]','top'); I can ...
1
vote
2answers
833 views

Rewrite custom post type url's adding meta box values

I've got these custom post types (CPT) and meta boxes: Movies (CPT) Genre (Meta box) Genres (CPT) If one movie is called Die hard then I want the permalink to be: /genres/action/die-hard This ...
1
vote
1answer
270 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', ...
1
vote
0answers
109 views

How to pass url as a parameter in a add_rewrite_rule

I am building a plugin which relies on passing the url as a GET parameter. Now, I am trying to prettify the links by using rewrite rules but am stuck. What I have now: function ...
0
votes
1answer
387 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 ...
1
vote
0answers
144 views

Rewriting single post url; add_rewrite_rule problem?

I have to customize single post permalink (the structure of the permalink) if posts have a certain value in a certain custom fields. I use the filter post_link to change permalink when needed, and ...
0
votes
0answers
194 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
52 views

Permalink of Custom Post Type

I am trying to create a custom post type called an 'event' and have it's permalink structure be as follows: www.domain.com/events/238 where 238 is the post ID. However, when I navigate to the page, ...
0
votes
1answer
321 views

What is the proper way to use add_rewrite_rule to remove the (question mark)?

I have a page called "People" with a custom template that takes in a variable called name: example.com/people/?name=FirstLast What I want is this: example.com/people/FristLast I know I need to use ...
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
350 views

why does add_rewrite_rule refresh and loose url variables

I am using: add_action( 'init', 'add_author_rules' ); function add_author_rules() { add_rewrite_rule( "support/([^/]+)/?", "index.php?category=$matches[1]", "top"); } in the ...
3
votes
3answers
269 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( ...
1
vote
1answer
144 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 ...
0
votes
1answer
136 views

Canonicalization + Custom Post Types not working as expected

I have an issue with Canonicalization where on Custom Post Types say for example: /custom-post-type/{post_id}/fake-post-name/ is loading up but not redirecting to : ...
0
votes
2answers
127 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
247 views

URL rewrite breaking pagination

I have been reading around and cannot seem to figure this out. Everything is working fine except that pagination seems to not work, I am adding a second rewrite rule, shouldn't this fix that? I can ...