Tagged Questions

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

1
vote
0answers
164 views

Struggling with add_rewrite_rule

I've read this: Wordpress redirection to get url friendly That led me to this: 1) wp.tutsplus.com/tutorials/creative-coding/the-rewrite-api-the-basics/ 2) ...
1
vote
0answers
141 views

Evaluating a external rewrite rule before internal wordpress rewrite rule

I am been plucking out my hairs since last few days trying to solve this problem: I want to convert my urls from format http://example.com/prodsearch/category/tag1-tag2-tag3-tag4 to ...
1
vote
1answer
642 views

Optimal code for two add_rewrite_rule's

I have two custom rewrite rules; after reading allot of great posts here I found a way to make them work. The question is this: Is there a way to merge this code? I'm not sure that the way I wrote it ...
1
vote
1answer
95 views

Different rewrite rules for taxonomies and cp in multisite?

I´m making a multilingual site with multisite and I`m wondering if you can specify different rewrite rules for taxonomies and custom posts for the different sites, that are using the same theme. Maybe ...
3
votes
2answers
734 views

add_rewrite_rule and attachment_id

Im trying to add a rewrite rule to make this mysite/?attachment_id=106 view like this mysite/series/106 Ive looked evetywhere in this site and others and its very confuse because there are lots of ...
0
votes
2answers
620 views

custom wordpress rewrite

I am trying custom rewrite for following url... http://www.domain.com/lp/1 and it would be parsed using lp.php?p=1 I have tried following... add_action( 'init', 'aagt_rewrite_add_rewrites' ); ...
0
votes
1answer
165 views

Problems with rewrite rule

I realy cant to figure this out. What i want to do, is this URI http://www.hotels-lithuania.net/index.php?page=76&type=hotels&id=1 transform to http://www.hotels-lithuania.net/item/hotels/1. ...
4
votes
3answers
1k views

add_rewrite_rule not loading correct page nor getting variables

I've trying to get a showreel title and video id into an URL that can then be accessed by the page. i have the two in the same URL and it either doesn't work or only one comes in. Currently the page ...
1
vote
1answer
180 views

Rewrite ugly URL to clean URL

Im trying to go from: http://www.example.com/product?level1=value1&level2=value2&level3=value3&level4=value4 To: http://www.example.com/product/value1/value2/value3/value4 Sometimes ...
5
votes
1answer
1k views

add_rewrite_rule() vs $wp_rewrite->rules vs 'rewrite_rules_array'?

I've written Rewrite rules for my custom post types. they work well except that WP doesn't update the url in the User Agent when the redirect_url doesn't match the requested_url. everything else ...
1
vote
1answer
656 views

Does WP Have a Function To Generate .htaccess RewriteCond?

I know that I can edit .htaccess manually and add a RewriteCond statement inside, but I need to build a plugin that does this the proper way by using WP rewrites which then get pushed into .htaccess ...
0
votes
1answer
254 views

Rewrite /category/cars into /topics/cars

I know there are plenty of question and posts about this out there, however I couldn't find a solution or existing thread to my specific question. If I list my categories and click on "cars" the url ...
6
votes
2answers
820 views

Problem with add_rewrite_rule and pagination (paged and page query_vars)

I have a custom taxonomy named location and I want to add sections like 'news' and 'marketplace' for each term, so my url looks like /location/montreal/news/ It works perfectly until I try to add ...
1
vote
2answers
2k views

Fatal error: Call to a member function add_rewrite_tag() on a non-object in /wp-includes/taxonomy.php on line 333

I get this error while trying to load wordpress in a smarty template. But when I visit wordpress I dont get that error any where. the code I use to load wordpress is : {php}include ...
0
votes
1answer
125 views

Requested URL changes when using custom rewrite rule

I'm having basically the same problem as question #44117. I have a custom rewrite rule set using add_rewrite_rule, but when the user goes to the page, the entered url changes and the value is lost. ...
1
vote
1answer
248 views

How To Consistently Enforce Rewrite Rule in Plugin Development

Let's say I create a customer support plugin that hijacks the /support part of the URL and redirects it to an MVC framework in my app folder of my plugin folder, like so: RewriteRule ^support(.*)$ ...
4
votes
1answer
420 views

Custom Rewrite Rules Not Sticking

I've written some custom rewrite rules for a special feature on http://www.pewhispanic.org/states/. States is a page with a custom page template, page-states.php. The logic for returning the right ...
1
vote
1answer
1k views

Auto generate rewrite rules for multiple taxonomies

so i'm back with rewrites... i am looking for a more automated solution. i stumbled across this on the interwebs: /** * Generates all the rewrite rules for a given post type. * * The rewrite ...
3
votes
1answer
882 views

add_query_vars and add_rewrite_rules

I am looking for some clarity on what add_rewrite_rules does. If I type in, or submit variables from a form, is it supposed to change the query variables to the pretty url? Currently when I type in ...
1
vote
1answer
102 views

custom template rewrite

I have a page called my-todo-list and is using a custom page template. The page is accessible via this type of URL : http://domain.com/my-todo-list/ Now I need to paginate it, and I want to look ...
2
votes
2answers
2k views

Rewrite Rules for Multiple (more than 2) Taxonomies

I am using woocommerce and have some 'product attributes' which are just a taxonomies. I have the following taxonomies: pa_color pa_material pa_style the pa_ stands for product attribute and it ...
0
votes
1answer
309 views

Keep requested/entered url with add_rewrite_rule

I've got url-rewriting partially working. I have this rule: ...