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

2
votes
0answers
42 views

Case-insensitive add_rewrite_rules in Wordpress functions

Been hitting my head against the wall on this for a while. If I have a add_rewrite_rules like so: $aNewRules = array('my-books/?$' => 'index.php?pagename=my-books'); This works correctly; ...
2
votes
0answers
171 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 http://...
1
vote
0answers
18 views

add_rewrite_rule permalinks break in WordPress 4.5

I have a plugin that uses permalinks to deliver content to the page based on an activity that I pass in through the URL, eg. mysite.com/activity/11. I also have code in my plugin that redirects the ...
1
vote
0answers
28 views

category slug and page slug same

I have "movies" category name/slug and i have same page slug/name "movies". My category page: sitename.com/movies/page/2,3,4 bla bla My page url: sitename.com/movies/query If i enter first page on ...
1
vote
0answers
17 views

How to add rewrite rule for external php file

My permalinks set to post-name. I have a php file named 'user-messages.php' in my theme directory. I want to include this php file for this "http://www.example.com/user/messages/" url and if url ...
1
vote
0answers
22 views

how to change permalinks format for pagination?

Sorry if my question was basic or stupid. Please help me how to do this in wordpress, i m new to wordpress. I have permalinks for pagination page like this www.website.com/customtaxonomy.html/1 www....
1
vote
0answers
144 views

Multisite theme path rewrite using .htaccess

I'm trying to rewrite the theme path for multiple domains (wordpresss multisite) using separate themes, this is my current .htaccess file, this is allowing each site to use seperate CSS files but not ...
1
vote
0answers
108 views

How make a multi language routes, with rewrite rules or rewrite endpoints?

I want to know a concept of making a multi language routing system for WP. That is the best practice, to make this routing system with add_rewrite_rules for pages post arhive etc in part, or to use ...
1
vote
0answers
185 views

Rewrite rule for path of favicon.ico ( Add_rewrite_rule function possible ? )

Hi Wordpress developers ! I'm wondering, is it possible to make by PHP and power of Wordpress following: If user access http://localhost/favicon.ico, is it possible to make show user data from http:/...
1
vote
0answers
255 views

add_rewrite_endpoint() and Custom Post Type Archive

I've got a custom post type. Let's call it books. I'm adding a new rewrite endpoint called pages. I want the url /books/pages/2/ to work but I don't see any rewrite rules generated by WordPress for ...
1
vote
0answers
831 views

wordpress add_rewrite_rule not working

I have page on my site named annuaire-membres and i want this with my custom search like this example.com/annuaire-membres/character/A or example.com/annuaire-membres/department/xyz for this I ...
1
vote
0answers
1k 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 ...
1
vote
0answers
245 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 ...
1
vote
0answers
2k 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 ...
1
vote
0answers
206 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 ...
1
vote
0answers
271 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 ...
1
vote
0answers
64 views

Customise particular RSS permalink

From my old static website, I want to preserve some URLs like the RSS Feed one. My feed URL is http://traduction.bainslesbains.com/actualite-russe.xml and I want to redirect it to the category feed ...
1
vote
0answers
121 views

What add_rewrite_tag()'s RegEx matches against?

I'm trying to figure out wether I can specify the position of the string to match (i.e. immediately after the domain) to reduce the chances of matching something else, but I don't even know what the ...
1
vote
0answers
197 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) wp.tutsplus.com/tutorials/creative-coding/...
0
votes
0answers
15 views

Use RewriteCond for add_rewrite_rule

Is there any way to add a custom RewriteCond in the htaccess using wordpress functions like add_rewrite_rule. I need to add this rule to wordpress. RewriteCond %{HTTP_HOST} ^(?!www)(.+)\.example\.com ...
0
votes
0answers
9 views

Rewrite Rule for Multistep Estimate Form

I want to be able to create a few rewrite rules and utilize some templates that I've created, but I don't want to be limited by having to create the pages within the WordPress admin ... essentially, I ...
0
votes
0answers
30 views

How can I add rewrite rule for custom page?

I'm showing child categories data in custom page using wordpress. Problem is that i'm fetching those child categories from parent category slug. www.example.com/digital-post-page/?cp=category-slug ...
0
votes
0answers
13 views

add_rewrite_rule redirection okay, but not detecting add_rewrite_tag as query_var

I'm having an odd issue with add_rewrite_rule and add_rewrite_tag I basically am creating a page so that if you go to:- http://domain.com/enquire-now/test/ It will go the equivalent of:- http://...
0
votes
0answers
31 views

Problem in defining custom permalink for custom post type

I have created a custom post type i.e. Movie of The Year by the following code. class Twenty_Fifteen_Post_Type_With_Rewrite { private $post_type; private $query_var; private $...
0
votes
0answers
16 views

Partial matching issues in rewrites api

I'm working on a site that has a lot of custom rewrites. We started with: function em_rewrite() { add_rewrite_rule( '^state/([^/]*)/([^/]*)/?', 'index.php?state=$matches[1]&city=$matches[2]',...
0
votes
0answers
38 views

Page URL with variable (URL rewrite)

I'm new to this Wordpress & right now I tried to rewrite a specific page that have variable with it. First of all let me explain. I have a page that will retrieve all loggedin user info in a page ...
0
votes
0answers
26 views

wordpress rewrite and keep url for page

I am using the rewrite api with the following that works... add_rewrite_rule( '^ch/(\d+)', 'index.php?p=$matches[1]', 'top' ); The idea is that the ch identifies it as Chinese and the ...
0
votes
0answers
21 views

add_rewrite_rules

I'm moving an old blog from Typepad to WordPress and trying to maintain permalinks. I'm hoping to drop the /category/ base from category urls and add /index.html to monthly archives. I have these two ...
0
votes
0answers
36 views

Multiple Sub Domain Names - One WP Install (non-Multisite) - Default Each Sub Domain name to AUTHOR Archive

Use case is somewhat simple - here goes: Unlimited people share a single wordpress install - not multi-user Each person blogs and puts their posts in a their own unique author archive Each person's ...
0
votes
0answers
34 views

Modify custom taxonomy permalink to allow 2 additional parameters?

I have a custom post and taxonomy set up. The only section I have in my website are taxonomy archives. The archive page lists the posts from the current taxonomy term. Each post is viewed in a modal, ...
0
votes
0answers
41 views

post_type_link and add_rewrite_rule

I created 3 custom-post-types: 'Category', 'Main-Thing' and 'Part'. Via Plugin I connect them, while 'Main-Thing' has a 'Category' and a 'Part' belongs to a 'Main-Thing'. I do not use any taxamonies ...
0
votes
0answers
27 views

Update broke rewrite rule

With the update from 4.4 to 4.4.1 somehow suddenly my rewrites aren't working anymore. I've written a plugin to show attachments on a page (the landing page specifically) so people that come to the ...
0
votes
0answers
66 views

Dynamic variable in add_rewrite_rule

I'm trying to insert dynamic part of URL in add_rewrite_rule() when activating plugin. I have a config array $config = array('rewrite_key' => 'whatever'); and a function which do some stuff ...
0
votes
0answers
38 views

Permalink structure between 2 custom post types and a taxonomy

Ok here is the scenario. I have a custom post type called "Communities", a custom post type called "Community Posts" and a taxonomy under "Community Posts" called "Communities". The idea here is that ...
0
votes
0answers
72 views

Custom permalinks for search with extra parameters

I am trying to change default WordPress permalinks for search because I added few parameters to search.php the url now is like: https://www.example.com/wordpress?parameter1=test&parameter2=text&...
0
votes
0answers
88 views

add_rewrite_rule -> filter posts and custom taxonomy

Hello I want to add a custom permaling structur and based on that use a specific template for displaying posts: For example i have: category=football category=baseball and custom taxonomy ...
0
votes
0answers
20 views

rewrite rule added to function.php not work

Hello in my custom plugin i want to set custom rewrite rules. First i trying make this with one rule, so i create functions.php file in my plugin folder and i paste into this code: function ...
0
votes
0answers
20 views

Pagination redirection in WordPress

I had a blog website in a custom CMS. I recently re-developed the website in WordPress. The old website had pagination urls like "?page=2" But WordPress shows pagination urls like "/page/2" Now what ...
0
votes
0answers
62 views

Add conditional rewrite rule depending on user agent

My problem is the following : I'm buiding two wordpress themes with an angularjs app inside each of them. One theme is desktop, the other is mobile. The theme switch is made by this plugin : https:/...
0
votes
0answers
31 views

WP Rest API blog with detail page

I've a blog on a other site, and with the WP Rest Api I want to show the excerpts on a other site, with a custom single page. I've made a page_blog.php page where I show the posts, and now I want to ...
0
votes
0answers
63 views

Add Rewrite Rule giving 404 Error

I'm having a little problem with Wordpress add_rewrite_rule function. I'm trying to accept a user subscription by using the URL from the email I've sent. The hash I use is generated from ...
0
votes
0answers
88 views

Wordpress URL Rewrite is removing special characters

I'm having a little problem with Wordpress's built-in add_rewrite_rule function. It's quite simple: I have a newsletter form, which sends a confirm mail to users, with a confirm code. Let's say that ...
0
votes
0answers
44 views

add_rewrite_rule questions

I've read several tutorials on the subject, but am not seeming to be making headway here. Ultimately, I am trying to write the following url: example.com/parts/by_model/YEAR/MAKE/POST-NAME/# Where ...
0
votes
0answers
108 views

add_rewrite_rule using custom taxonomy and year

I have a CPT called books and a custom taxonomy called genre and need to show in a page all books of a specific term and a specific year. For that, I created taxonomy-genre.php file and created a ...
0
votes
0answers
40 views

How to generate Short URL for my documents in Wordpress

Scenario I have a custom table with documents. This table have other fields but couple of them only relevant to my question are ID, and PATH. Majority of documents stored are PDF files and therefore,...
0
votes
0answers
40 views

Rewrite URL Category + Tag

I want to rewrite some URL's in my Wordpress site. The idea is to change URL's that has been generated by a search form across custom categories and custom tags. For example: example.com/mycategory/?...
0
votes
0answers
34 views

Mixed CPT permalink structure

Im working on a site and i would need to add new features to the The Event Calendar plugin. The plugin uses tribe_events for event CPT and tribe_events_cat for Event category taxonomy. I need ...
0
votes
0answers
18 views

Provide a Special URL with Parameters

I need to provide some Data in JSON on multiple special URLs. The URL should look like this: example.com/mobile/get_event_list?ts_loc=1435576599 or, more general example.com/mobile/[service]?[...
0
votes
0answers
112 views

Blog List Page 404 With Custom Post Type Rewriting to Blog Parent

There will be a lot of code blocks below, but here's the short version: On a site, I have a Resources custom post type, with a Resource Types taxonomy. The URL for a Resource Type post archive is: ...
0
votes
0answers
84 views

Pagination appearing twice in URL after rewrite

For my site, I have a custom post type video set to appear at at the URL http://site.url/videos. It is paginated so that there are 24 videos per archive page. However, I am not using the single.php to ...