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
1answer
15 views

Rewrite rule : custom post type with 2 numeric variiables

I have a wordpress site using a custom post type "gallery" to show some photos. I can't find the right regex to match my url variables (i'm a novice with regex) What i want to achieve is to get this ...
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 ...
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 ...
0
votes
2answers
2k 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
1answer
12 views

Change url to posts if they have custom tax only

I have custom taxonomy "category_slider". function taxonomy_slider() { $labels = array( 'name' => 'Категории проекта', 'singular_name' => 'Категории', 'search_items'...
4
votes
1answer
2k 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 ...
0
votes
1answer
739 views

add_rewrite_endpoint not working

I've been having looot of troubles with this function, I don't know what to do, because I tried everything. I have a custom post type, let's call it study. The url structure for it is http://...
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
1answer
725 views

Wordpress monthly archive links result in 404

When I use the archive widget in a sidebar, it creates the normal monthly post archive listing like the following: February 2014 January 2014 October 2013 and so on. Whenever I click on these ...
1
vote
3answers
505 views

add_rewrite_rule not working for me

I have the following rewrite tags defined: // ADD REWRITE TAG FOR 'VEHICLE MAKES' add_rewrite_tag('%make%','([^&]+)'); // ADD REWRITE TAG FOR 'BODY STYLES' add_rewrite_tag('%body-style%','([^&...
0
votes
1answer
725 views

Simple page URL rewrite with add_rewrite_rule()

I've check on previous post but my problem seems to not be covered by answers. I have a WP install into a subfolder www.example.com/sub-folder/ and a page password protected www.example.com/sub-...
5
votes
1answer
74 views

Custom rewrite rules for archive page and single post

I'm building a Wordpress site with several custom post types. Every post type is a different magazine. I have also a custom meta fields for a magazine year and issue. I would like to have urls (used ...
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 ...
1
vote
1answer
59 views

add_rewrite_rule is not taking effect in Wordpress? .htaccess file doesn't update

I have tried all day to get my own rewrite to work in wordpress, but I simply can't get anything to work. I've tried so many different ways but thing is nothing updates in the .htaccess file so I am ...
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 ...
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 ...
1
vote
1answer
30 views

Adding two rewrite rules

I have a custom post type with a custom taxonomy. The custom post type is news. The custom taxonomy is new_category. What I want is the possibility two operate link that: http://example.com/news/ -...
0
votes
1answer
511 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 ...
3
votes
1answer
64 views

Add rewrite rule to permalink structure

I have a Custom Structure setup for posts in Settings > Permalinks as: /%category%/%post_id%-%postname% This works great for most of my posts, but there is one category that I want to remove the ...
1
vote
1answer
51 views

Does flush_rewrite_rules() remove all rules added by other plugins as well as mine?

I am developing a plugin, and am using add_rewrite_rule followed by flush_rewrite_rules during plugin activation. On plugin deactivation I am using just flush_rewrite_rules to remove the rule that I ...
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
32 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 $...
3
votes
1answer
25 views

Multiple values in a rewrite rule, is it possible?

I'm using url rewrites for a filter i'm building. The current solution works for one selected value. So if I select one type of dish like dinner, it goes to /recipes/dinner/. But what if I want to ...
3
votes
1answer
62 views

How to change URL Custom Page?

My Page Custom URL: http://abcd.com/watch?name=video-title How can I change this url to http://abcd.com/watch/video-title where watch is a custom page? My functions.php code: function ...
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; ...
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]',...
1
vote
1answer
22 views

Wordpress add_rewrite_rule() cannot visit lower url levels

I have a post type called "shop" and added query variables and a rewrite rule. // Adds query vars for shop post type function gtp_add_shop_query_vars( $vars ) { $vars[] = 'shop-category'; $...
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
28 views

Taxonomy rewrite problem [duplicate]

I created new custom post type called "projekt" and taxonomy "kategorie" with rewrite "realizacje". What I need is create that structure: /realizacje/ - archive for all /realizacje/taxonomy/ - ...
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
1answer
26 views

Custom Post Type rewrite url to /category/pagetitle [duplicate]

I know this questions has been asked a lot, but after working on it for 6 hours straight I can not find a good solutions anywhere. My site has a Custom Post Type and taxonomy. My taxonomy are for ...
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
1answer
52 views

add_rewrite_rule with bottom priority doesn't handle the Wordpress pages

I have a php file named test.php that outputs the page querystring parameter. I want to use add_rewrite_rule to serve my php file, while the WordPress pages which exist already or will be created ...
0
votes
2answers
16 views

Adding Rewrite URL for Base + Children Separately

I have a main page and beyond that it has children. I successfully rewrite the children like so: add_rewrite_rule('my-url/?([^/]*)', 'index.php?my-var=$matches[1]', 'top'); This works great. But ...
1
vote
1answer
254 views

Using add_rewrite_rule() to redirect to Front Page

I'm using a static page for my Front page. It is a custom template. On my custom template I am using WP_Query() to show a list of posts. I also have a custom taxonomy called "Types" that I use on my ...
1
vote
1answer
36 views

Pages should have priority when using add_rewrite_rule

I'm using the following code to have dynamic pages function custom_rewrite_basic() { add_rewrite_rule('^prefix-(.*)', 'foo/bar/index.php?page=$matces[1]', 'top'); } add_action('init', '...
1
vote
1answer
34 views

Help with rewrite rules for two post types

I'm trying to setup two rewrite rules for two post types. Basically, the structure I want is this: site.com/app/course/xxxx/ => adds query_var course site.com/app/course/xxxx/theme/xxxx/ => adss ...
0
votes
1answer
45 views

Multiple query vars sorting combination and url rewrite

I have a custom search page for a custom post type ('program'). There are 4 parameters that can be set up for this search: 'word_search', 'archived', 'category' and 'operating_system'. We can search ...
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 ...
1
vote
1answer
35 views

Plugins rewrite rules the right way

I need to create rewrite rules for my plugin. This plugin will be running on a very large WordPress Network (+2000 sites) so performance is important. Most tutorials and the codex recommend to ...
1
vote
1answer
177 views

Rewrite rules and query for virtual page

My question comes from this one. I have never really touched on rewrite rules as frankly, they still do not make sense to me What I have I have successfully build the following link http://...
0
votes
1answer
17 views

Rewrite Rule added but showing 404 rather than specified page

I have the following rewrite rule function coaching_apply_rule() { add_rewrite_rule('^coaching/apply/', 'index.php?page_id=5156', 'top'); } add_action('init', 'coaching_apply_rule'); Reason for ...
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
1answer
125 views

query_vars empty when using custom url with custom rewrite rule

I'm trying to pass custom url parameters to pretty urls using add_rewrite_tag('%product%', '([0-9/]+)'); add_rewrite_rule('^sign-up/product/([0-9/]+)?$','index.php?pagename=sign-up&product=$...
5
votes
1answer
225 views

Dynamic Endpoints

I have a database table outside WordPress that I need to make endpoints for. I've created a page /cars/ where I plan on using a page template to generate links. I would like for the url to look like /...
-1
votes
1answer
450 views

404 Error On Custom Taxonomy Pages 2, 3, etc

I've been reading a bunch of posts about this with no luck so far. I can't seem to figure out what is the problem. I have the following: Custom Post Type: Sermons Custom Taxonomy: Series My urls ...
0
votes
0answers
67 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
1answer
86 views

Rewrite URL - insert custom variables as a directory path

I'm trying to re-write permalink structure with my own custom url in wordpress for a Divi Theme "project" I have already changed the "Divi slug" from "project" to "prodotti" so currently the url ...