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
17 views

Need help with custom rewrite rule

I have a CPT called presskit, and I need to add a custom query var named welcome_box. I have this code right now: function my_new_url_querystring(){ add_rewrite_tag( '%welcome_box%','([^&]+)' ...
0
votes
0answers
14 views

Stop WordPress from redirecting ?p= in custom rewrite rule to slug of page

I've written a custom rewrite rule, which should rewrite a specific case of a taxonomy url to serve a page. The rule is as follows: add_rewrite_tag('%tax_slug%', '([^&]+)'); ...
0
votes
2answers
336 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 ...
2
votes
1answer
19 views

Single Redirection Rule for Pages and Archive links

I am trying to find pretty URL solution for url parameters. Consider this url set http://example.com?token=foo http://example.com/pagename?token=foo http://example.com/parent/childpage?token=foo ...
0
votes
0answers
13 views

Rewrite URL of a page which is child of a Custom Post Type

With the plugin Types I've created a hierarchical custom post type "journeys", and then I set that normal "pages" are child of "journeys". I've created a "journeys" post called "My First Journey". ...
0
votes
0answers
7 views

WordPress Rewrite/Query Var .. ignore a word?

I have created an 'event listing' area on my WP website, it uses rewriting and a query var to dynamically load the event 'slug' as a variable so that I can add pages on the fly. However it has broken ...
0
votes
2answers
25 views

add_rewrite_rule isnt working, not getting added to rules array, why?

I'm trying to add a new rewrite rule but it doesn't seem to be getting added to the array and it certainly isn't working. I'm trying to get this URL, dult.dev/lists/games/destiny, to take me from a ...
0
votes
2answers
951 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
25 views

configuration of .htaccess for add_rewrite_rule to make sense

I am trying this code from codex wordpress site function custom_rewrite_basic() { add_rewrite_rule('^leaf/([0-9]+)/?', 'index.php?page_id=$matches[1]', 'top'); } add_action('init', ...
3
votes
1answer
1k 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
339 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 ...
0
votes
0answers
23 views

Widgets: Ajax Filtering and Add rewrite rules

I have built an Ajax filtering plugin for my widgets that works by adding url params through jQuery (when a link is clicked) and having pre_get_posts $_GET these values. These values then setup the ...
0
votes
2answers
439 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' ...
0
votes
0answers
14 views

add_rewrite_rule not working on WordPress site

For my WordPress site I am trying to make two URLs display the same content, without redirecting to the other page. So, for example I want to make: ".../books/ilium" display the same content as ...
0
votes
0answers
13 views

using two different urls for same post

I want to use two different permalinks for same post for some reasons the permalink structure i need are http://www.example.com/category-name/post-name http://www.example.com/post-name please help ...
0
votes
0answers
8 views

add_rewrite_rule working for posts but not for pagination

I have used add_rewrite_rule to change my urls please check the code below. add_rewrite_rule( '(.+?)/([^/]+)/?$', 'index.php?category_name=$matches[1]&name=$matches[2]&is_play=1', ...
0
votes
0answers
19 views

I am trying to add a mode rewerite rule that seems to fail

I am trying to redirect everything from /app/.... to a certain page Will use that later for angular js. This is what i came up with : add_rewrite_rule('/app/.*', 'index.php?page_id=11', 'top'); ...
1
vote
1answer
735 views

add_rewrite_rule() not working

I need to pass a property reference the last part of a URL to search the database for an entry, eg, http://example.com/cottage-details/G638/ I need to pass the G638 into an array for my ...
0
votes
0answers
23 views

WordPress render's 404 for known rewrite rule

I have defined rewrite rule for my hieratical custom post type. remove_filter('template_redirect', 'redirect_canonical'); function add_artists_query_vars($aVars) { $aVars[] = "work_index"; ...
0
votes
0answers
16 views

Intermittent Rewrite Problems

I have a few custom rewrites on a site I have developed. I'm having a couple of issues: The rewrites don't work properly without using "flush_rewrite_rules(true)" directly following their setup. It ...
2
votes
1answer
1k views

Change the Permalink for wordpress attachment

My attachments are currently rewritten from http://localhost/?attachment_id=3 to http://localhost/images/image-title using @Bainternet's answer here. $new_rules['images/(\d*)$'] = ...
0
votes
1answer
61 views

My add_rewrite_rule is returning a 404

I'm using Nginx and a custom add_rewrite_rule that looks like this: function add_pony() { //this should allow me to POST to domain.com/pony add_rewrite_rule('^pony$', 'index.php?pony=true', ...
0
votes
0answers
14 views

WP Rewrite - some rewrite rules are ignored and instead a redirect is served

I am trying to allow any URI that's prefixed with pf/ to show a page without redirection. I do this by filtering rewrite_rules_array and simply duplicating the rules with a pf/ prefix public function ...
1
vote
1answer
33 views

How to building pretty URLs to reflect category hierarchy?

At the moment, this is how I access brands (custom post type) on my page: http://example.com/<base>/<brand> I would like to access brands like this: ...
0
votes
0answers
21 views

Wordpress add_rewrite_rule with priority

I'm working on a Wordpress website which shows companies in a city. The URL's are like www.address.com/new-york/. I've created a rewrite rule for this and it works but now i'm not able to visit any ...
0
votes
1answer
38 views

How to change the displayed URL?

I'd like URLs like this: http://example.com/root/branch/twig/ be rewritten and displayed to a URL like the one below: http://example.com/root/twig/ At the moment, the two URLs point to the same ...
0
votes
0answers
47 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 ...
4
votes
2answers
579 views

Custom pages with plugin

I'm developing some plugin where I would like to enable custom pages. In my case some custom page would contain a form like contact form (not literally). When user will fill out this form and send it, ...
2
votes
2answers
223 views

different child theme for subdomain

I've got a site that I'm trying figure out how to apply different child themes to based on a subdomain. Applying the child themes shouldn't be difficult, it's more the .htaccess magic that I'm a bit ...
0
votes
0answers
18 views

Custom rewrite rule returns post instead of (start)page

I need a custom rewrite rule so that /a/b/c/d/123 points to the startpage because my own plugin on the startpage needs those parameters from the URL. / I was able to accomplish most of ...
0
votes
0answers
33 views

Trying to add $_POST Array to update_post_meta doesn't populate

This is the code that is sending the info: $postdata = array( 'show_id' => '11', 'show_start' => '2015-03-17 11:00am', 'line_items' => array( '1' => array( ...
0
votes
1answer
45 views

redirect old post type url to new structure url

i have one cpt Anime and it has post_type taxonomy with term anime and animation anime(cpt): (site domain)/anime/post title | |-(tax)Anime |-(tax)Animation And my url structure are ...
0
votes
1answer
31 views

Using category slug in add_rewrite rule

I'm using this function ro rewrite URLs: function archive_rewrite_rules(){ add_rewrite_rule( 'inspiracao/([^/]*)/([0-9]{4})/?$', ...
0
votes
1answer
24 views

Do rewrites added with add_rewrite_rule() persist after plugin deletion?

I am developing a Wordpress plugin and need to ad a rewrite url using add_rewrite_rule(). That does work. But what happens when my plugin is deleted? Does Wordpress cleanup the htaccess or do I need ...
0
votes
0answers
21 views

How to prefix all rewrite rules in wordpress?

I want to prefix all permalinks in wordpress, and get this value from query_args. For example http://wp.dev/sample-page transform in http://wp.dev/en/sample-page. I want for all permalink, for page ...
0
votes
0answers
51 views

RewriteRule directive not working without [P] flag

I need to rewrite some URL's, but I ran into strange problem. For some reason RewriteRule directive only works if I use proxy flag, for example: RewriteRule ^foo$ /www_dev/test/page2-2/ [P] works as ...
0
votes
0answers
44 views

Adding custom post types and add custom add_rewrite_rules

I am adding custom post types using the class created by https://github.com/jjgrainger/wp-custom-post-type-class I am then adding classes using this to add rewrites: /** * Class to init our mvc * ...
0
votes
0answers
33 views

add_rewrite Rule

I want to add a rewrite rule, the remove the "base" from a custom taxonomy link. There current structure is: http://example.com/bundesland/TERMSLUG I would like to have it like this: ...
0
votes
0answers
21 views

Remove rewrite path for custom taxonomy [duplicate]

I want to get rid of the rewrite path for a custom taxonomy. This is the way, I register it: register_taxonomy( 'bl_tax', array( 'stadt'), array( 'label' ...
1
vote
1answer
132 views

add_rewrite_rule query_var not being set

I have an unusual use of add_rewrite_rule (is there a usual use?) and I am getting some unexpected behavior. First here is my code: if(!empty($list_view_template)) add_rewrite_rule( ...
1
vote
1answer
2k views

Custom query_vars and parse_request on wp-admin

I've read this post http://wordpress.org/support/topic/query-vars-in-admin and although it's quite an old question, it suits me perfectly. I'm trying to accomplish what I already posted here: ...
0
votes
0answers
57 views

$error = 404 after caught add_rewrite_rule

I have a rewrite rule as this to caught old urls from a previous version of the site: add_rewrite_rule( '(ninos|familia|hogar|mujeres|hombres)-[a-z-]+\.php', 'old_id_redirect.php', 'top' ); The ...
0
votes
1answer
60 views

WP redirect rule doesn't work

I'm trying to redirect the page http://www.example.org/newsletter/unsubscribe.html to http://www.example.org/newsletter/unsubscribe. I have tried the following: ...
0
votes
0answers
25 views

Rewrite Rule Regex

I've added rewrite rule: add_rewrite_rule( 'slider-settings/(\w*)$', 'index.php?pagename=slider-settings&slider_id=$matches[1]', 'top' ); This url ...
0
votes
0answers
43 views

Custom rewrite rules without a sub folder path to identify clash with pages

I need to be able to have routes to links that are both pages and products from the main wordpress root directory, without anything to distinguish between what a product (which is a template_redirect) ...
2
votes
1answer
117 views

add_rewrite_rule, plugin activation and plugin deactivation

I see a lot of example showing to call add_rewrite_rule in your init hook, e.g. function add_my_custom_rewrite() { add_rewrite_rule(... } add_action('init', 'add_my_custom_rewrite'); and in ...
0
votes
1answer
65 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 ...
0
votes
1answer
63 views

Custom Post Type with modified permalink structure results in 404

I've defined a custom post type, 'Review', that I'd like to utilize with a custom permalink: /reviews/year/postname. The below code correctly creates the CPT and the custom permalink appears correctly ...
1
vote
1answer
625 views

Custom rewrite rule for backend/admin?

I would like to create a custom rewrite rule that will take the URL: http://domain/submit-project/add but display http://domain/wp/wp-admin/post-new.php?post_type=project Is there any way to do ...
1
vote
1answer
25 views

Best action to call add_rewrite_rule

In Codex I found that the best action to call add_rewrite_rule is the init action. So in this way the function is called every time the site load. But to save the rule in rewrite_rules option it would ...