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
0answers
7 views

How can I set up a secondary permalink structure?

So I have a situation on a site where I need multiple permalink structures. Now, I already know what you're going to say because literally every Google and SX result I've looked through says the same ...
0
votes
0answers
20 views

Rewrite rule not passing variable

I have the following code in my functions.php file, and it simply will not work to return the value passed via the URL. This is the code below: function custom_url_source() { ...
2
votes
2answers
201 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, ...
0
votes
1answer
29 views

add_rewrite_rule on multisite doesn't work

I define a rewrite rule on an init hook like: add_rewrite_rule( 'foobar/(abc|def|ghi)/(.+)(/(\d.+))', 'index.php?my_action=$matches[1]&my_name=$matches[2]&my_version=$matches[4]', 'top'); ...
2
votes
2answers
36 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
22 views

I want to add one extra field to my URLs, I'm using Rewrite functions but it doesn't work

I think my question isn't in the right way, I just ask it. I want this routings for my wordpress site (for example in Custom PostType Archive page): example.com/VALUE => ...
0
votes
0answers
21 views

Remove Rewrite Rule

after adding a rule: add_action( 'init', 'wpse26388_rewrites_init' ); function wpse26388_rewrites_init(){ add_rewrite_rule( 'usuario/([0-9]+)/?$', ...
0
votes
0answers
22 views

Rewrite pages and custom post type

I created a post type named soft_drink with a rewrite rule of /my_soft_drinks/%soft_drink%. my_soft_drinks is also a page slug. In my menu structure has the page soft_drinks parent submenu items. When ...
2
votes
1answer
50 views

Permalinks, Rewrites, Get Variables, Oh My!

Ok, so I know it's a silly title, but it's exactly how I feel right now.. I've created some custom rewrites for WordPress and they work great, the only problem is that now I need to add pagination. ...
0
votes
1answer
33 views

Create custom permalinks to show Custom Post Type's relationship?

I'm creating a WordPress site that has 3 custom post types registered: course, chapter, and lesson. All of these post types are inter-connected and share a relationship using custom fields. For ...
0
votes
0answers
19 views

URL mod rewriting for my custom links

My Actual link :- http://nanhai.com/nanhai-overview/162/ I want it like :- http://nanhai.com/nanhai-overview/xyz/ My code add_action('init', 'add_actor_url'); function add_actor_url() { ...
0
votes
1answer
49 views

Custom post types and custom variables — add_rewrite_tag() not working

I have spent a whole day trying to resolve in issue. I'm trying to retrieve a custom varaible which is added by my plugin. I have tried testing the regex using the rewrite analyzer, which recognizes ...
0
votes
0answers
29 views

Rewrite Rule Not Working

I am trying to use a rewrite rule to get 3 variables from the URL. Here is my rule: add_action( 'init', 'pe_rewrite' ); function pe_rewrite(){ add_rewrite_rule( ...
0
votes
0answers
75 views

URL rewrite custom taxonomy using add_rewrite_rule() or generate_rewrite_rules()

I'm trying to get my head around amending some URL's for a website I have created. After reading two (very informative) answers (1, 2) but I'm still a little unsure how to approach creating a URL that ...
0
votes
0answers
29 views

Set a Category As My Homepage using add_rewrite_rule

When someone visits the homepage of my wordpress site: http://www.mysite.com/wordpress/ I want them to see the contents of this page: http://www.mysite.com/wordpress/category/cars/ Attempt # 1: ...
0
votes
0answers
52 views

WordPress permalinks with Windows Server IIS6 - without ISAPI access

I'm having trouble to export the website to my client hosting . . I get an index.php in the url all the time, I've research about it, change the permalink custom structure to: /%postname%/ and add ...
0
votes
0answers
14 views

how to change some of the rules in the database

I need to add a rewrite rule for a WP page. I noticed that the rule is already part of the existing set, but apparently it is not correct. With the hope some internal mechanism would have replaced ...
0
votes
0answers
41 views

Help with add_rewrite_rule solution

In my Wordpress blog, I configured permalinks > Category base to "magazine" with links having this format: http://www.mydomain.com/magazine/news/europe/france The above link opens the France ...
0
votes
2answers
30 views

Rewrite for page with a possible unknown parent page

I am trying to add a wp rewrite for my plugin that allows users to include a shortcode on a page that will then display a calendar. This calendar then requires url params in order to navigate the ...
0
votes
0answers
21 views

Rewriting URLs with Query Strings

I've been (unsuccessfully) attempting to prettify some URLs in a website I'm building in Wordpress, from something like this - ...
0
votes
0answers
29 views

URL rewriting with custom pagination

I'm using a custom query to display the results with the pagination and rewrite the URLs. The following function works fine and displays the URLs in following pattern: ...
0
votes
1answer
56 views

rewrite rules social share links

Within the Ultimatum's theme childtheme.php I've added rewrite rules to the rewrite rules and it works perfectly fine. However, it does not work if the URL is shared in Facebook or Twitter. The ...
0
votes
0answers
31 views

add_rewrite_rule works only with one “directory”

This works (Wordpress redirects to the canonical URL of the post with the given slug): add_rewrite_rule('mydir/([^/]+)/?$', 'index.php?pagename=$matches[1]', 'top'); This is not working (404) ...
0
votes
0answers
34 views

How can i add a rewrite rule in wordpress

I want to add following rewrite rule in wordpress .htaccess using add_rewrite_rule() function. RewriteRule ^admin-panel/(.*) wp-admin/$1?%{QUERY_STRING} [L] how can i proceed? Thanks advance.
0
votes
0answers
62 views

Changing attachment page Permalink

How can i change the attachment page permalinks to http://domain.com/photos/%attachment_id%/%postname%/%attachmentname% currently my permalinks set to Custom Structure ...
0
votes
1answer
85 views

Rewrite Rule for Post “Subpage”, with pagination

I would like to know if is possible to add a "subpage" to a post and in this "subpage" have paginated content, for example: I Have a Post Lorem Ipsum This post has Videos, Photos and Audios as ...
0
votes
0answers
21 views

add_rewrite_rule is not fired

I need to rewrite some urls: I have a page (id = 61), with slug anunciantes on wich I use a custom template to generate a wp_query to list a custom post_type. I need to be able to filter by two ...
0
votes
0answers
18 views

Register frontend page without access in backend

I'm looking to register a page that can be accessed from the frontend, while not actually having it show up as a "page" in the admin. I had thought about creating the page programatically and then ...
0
votes
0answers
19 views

images gallery attached to a post as a subfolder of the same post

I would like to know how can I set the Lazyest gallery or other gallery plugin in order to add many pics to a post and the URL's pics to appear as a subfolder of URLs' post? For better understand ...
0
votes
0answers
50 views

How to programatically create a simple HTML page using the permalink of a Wordpress post?

I want a create a simple HTML page (not Wordpress Page) programmatically by using the permalink structure of another already existing post. E.g. Already existing post is ...
1
vote
1answer
56 views

How do I add a add_rewrite_rule without it redirecting?

I have a custom post type called "locations". I have a location called "starbucks". I can view this by going to "/location/starbucks". I would like to add "coffee-shop" to the URL, so the path ...
0
votes
1answer
47 views

Pretty Permalink for Search Queries Not Working

As the title suggests I am trying to create pretty permalinks for search queries, but unfortunately I cant get them to work. I am trying to achieve the folllowing: ...
0
votes
0answers
34 views

URL Rewrite for CPT single posts

I'm struggling with Wordpress' rewrite function I have the following URL structure http://example.com/album/test-7/ 'album' is the slug for the CPT single page 'test-7' is the slug for the CPT ...
0
votes
1answer
44 views

How to add a Rewrite Rule / Category Structure

I'm currently trying to use add_rewrite_rule() to create a rewrite (duh!), for a custom taxonomy page. I've added the rewrite tag "sort" with the following code: ...
0
votes
0answers
37 views

Why is my rewrite rule refreshing the page and removing my variables?

For some reason, the catch-all page rewrite rule is capturing this rewrite, rather than my own rewrite rule. My rewrite rule is listed at the top when doing a var_dump of the rules, as well as when ...
0
votes
2answers
77 views

add_rewrite_rule not registering on Multisite

I have a multisite install of WordPress. I have installed the plugin Monkeyman Rewrite Analyzer so I can see all the rules I have registered. The code below is how I am registering the rule: ...
0
votes
1answer
101 views

Call to a member function add_rule() on a non-object

I want the page mysite.com/product to be accessed with the URL mysite.com/product/productname instead of mysite.com/product?name=productname I am trying to achieve this with the code in the ...
0
votes
0answers
58 views

add_rewrite_rule regex issue

I am trying to add the following function into my functions.php through the WordPress editor but every time I try it says error 403 Forbidden - Access to this resource on the server is denied! ...
0
votes
1answer
42 views

Custom URL scheme - paramters on custom post type

I have a custom post type set up as Event. Within this post type I have various bit's of content / custom meta which will be used on two or three different pages. I was wondering lets say I had my ...
0
votes
0answers
38 views

Rewrite rule is not working

I want a custom rewrite rule for my plugin. But for some reason it is not working. I tried flushing url, registered query var. But still it wont work and it gives output like this: ...
2
votes
1answer
336 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*)$'] = ...
1
vote
1answer
76 views

Apache Fallback instead of add_rewrite_rule

My requirement is to do SEO Friendly URL for an existing site in Wordpress. For example, Current URL: http://test.com/test/?pid=19971 that is the page "test" is rendering the data from some custom ...
2
votes
1answer
204 views

Add specific word to default page permalink

Right now I am working on one of my client's project. Its all about amazon product display. My client wants me to change the permalinks of all posts, pages, serch results, archive pages, ...
1
vote
0answers
78 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 ...
0
votes
1answer
114 views

Getting add_rewrite_rule and add_rewrite_tag to work

I am new to using add_rewrite_rule and add_rewrite_tag. I am trying to get a very basic example to work, but nothing I do seems to make it work. I want to access this URL (this works when entering ...
1
vote
1answer
65 views

Custom rewrite_rules - only pass numbers and not alphabetic characters

I'm trying to add a rewrite rule to pass a var to a custom page template. For some weird reason it only excepts numbers in the variables, when I type in characters other then number it directs to ...
1
vote
1answer
38 views

Hooking “delete_option_rewrite_rules” for rewrite rule addition

I'm trying to find the most efficient way to ensure my word press "rewrite rules" are set correctly in the event that another plugin calls the flush_rules() function. Traditionally I've seen ...
1
vote
1answer
593 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
55 views

Custom URL in Wordpress with add_rewrite_rules and add_rewrite_endpoints

I have the following URL for a filter functionality that i try to build in wordpress: example.com/offers-type-all-inclusive-from-germany-transportation-airplane.html How can I make the arguments ...
1
vote
0answers
70 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( ...