Rewrite rules modify a web URL's appearance. This modification is called URL rewriting. Rewritten URLs (sometimes known as short, fancy URLs, search engine friendly - SEF URLs, or slugs) are used to provide shorter and more relevant-looking links to web pages. The technique adds a layer of ...

learn more… | top users | synonyms

2
votes
2answers
270 views

Add rewrite endpoint to author page + pagination

I want to add a new endpoint to the author page, so that the URL looks like this: http://example.com/writer/username/articles So far, I have: Changed the author base Added a rewrite rule Setup ...
2
votes
1answer
79 views

How to get wordpress link to fully evaluate when coming from facebook

The short version: Any link from Facebook to a page stops evaluating at the "hardcoded page" in the wordpress press install, ignoring the remaining parts of the URL. It doesn't allow the shortcode ...
2
votes
1answer
1k views

Permalink rewrite with custom post type and custom taxonomy

I think thats a quick one: I've got: Custom post type: Food Custom taxonomy (Registered to Food): Fruits Terms in Fruits: Apple, Orange, Cherry If I type in example.com/food?fruits=Apple,Cherry, ...
2
votes
2answers
3k views

Removing taxonomy base using WP rewrite

I´m trying to create the following URL structure: example.com/attractions <-- post type archive example.com/attractions/taxonomy_term <-- taxonomy archive ...
2
votes
1answer
898 views

Prettified page URL w/ query var redirects to prettified page URL w/o query var

I have a page created (page ID 235) with a page template that will need to be passed a variable. I would like to pass this variable through the URL. My first attempt was to pass this with a GET ...
2
votes
1answer
452 views

custom permalink/shortlink with base62 encoded post ID

I want my post-links to look like /%post_id62%_%postname%/ where %post_id62% is the post ID in base62 encoding (e.g. http://example.com/y9Rlf_test/) and my shortlinks to consist of /%post_id62% only ...
2
votes
3answers
2k views

Multiple post types - share same ReWrite slug?

I've run into another wonderful 404 issue. I'm trying to have 2 seperate post types that share the same rewrite slug. I've flushed my rewrite rules, and when I test only 1 of the CPT works- the ...
2
votes
1answer
80 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, ...
2
votes
1answer
499 views

How to achieve this permalink -> category-name/custom-post-type-name/post-name

I am trying to use categories to provide the structure for my site. I will create sections on my site called England, Wales, Scotland and Ireland . These will be categories. My posts will use custom ...
2
votes
2answers
2k views

Clean URLs for custom $_GET variables

I have a query var show=othertemplate that I can add to any URL to show any post, page or archive in Wordpress in a different template, like this: mysite.com/[any URL]/?show=othertemplate. I'd like ...
2
votes
1answer
332 views

When to call `add_rewrite_rule` for safety

I am starting to run into situations on projects where I am combining multiple plugins which all use add_rewrite_rule and flush_rewrite_rules at different points. As we all know, calling ...
2
votes
2answers
2k views

Custom Post Type Permalink / Rewrite not working immediately

Hitting a brick wall with the following: I have: 1 custom post type called cpt_community 1 custom taxonomy called tax_community If I set 'rewrite' => true in my CPT registration, then ...
2
votes
1answer
2k views

How do I remove a rewrite rule?

I've added a rewrite rule with the following code, and now I need to remove it. add_rewrite_rule('^events$', 'index.php?post_type=events', 'top'); My issue is not that the rule is not working. It ...
2
votes
3answers
485 views

Wordpress rewrite my URL when i use pagination

I've just created a rewrite rules to integrate pagination in my page music (displaying custom post_type "music") in order to : 1. displaying a specific page from a long musical playlist. 2. in this ...
2
votes
0answers
30 views

web.config conflict on IIS

folder structure docroot |- wordpress |- web.config |- wp-content |- japi |- index.php \- web.config ... ... As you can see there are 2 web.config ...
2
votes
1answer
93 views

Pagination problem

I have two custom rewrite rules: add_rewrite_rule('foo/bar/?', 'index.php?post_type=foo', 'top'); add_rewrite_rule('foo/bar/([a-z]+)/?', 'index.php?post_type=foo&bar=$matches[1]', 'top'); Which ...
2
votes
1answer
88 views

Regex in add_rewrite_tag not accepting OR operators?

I am trying to add a custom field to the post permalinks by using a combo of add_rewrite_tag and applying a post_link filter. What I am aiming for is something like this: ...
2
votes
0answers
73 views

Page Attachment Permalink Structure based on Menu Order?

I've been on a quest for the past couple of days reading up on Rewrite in WordPress but still can't seem to figure out how to accomplish this. When using pretty links in WordPress, media attached to ...
2
votes
2answers
353 views

Make post slug have priority over category slug

I have a wordpress site where the category base is stripped from the url. Now, when a category has a certain slug that's similar to a post slug, the category is shown. I would like to show the post ...
2
votes
1answer
156 views

Rewriting URLs in Wordpress

I am trying to solve a rewrite problem but don't fully understand how to read the below code. I believe the event/industry/(.+)/?$' is stating the format I want in my new url after rewritten, which ...
2
votes
1answer
742 views

How to rewrite custom post type with custom taxonomy urls?

I am working in a WP multisite which runs on a classipress theme and there is a custom post type "ad_listing" and custom taxonomy type "ad_cat". Now the url is like this ...
2
votes
0answers
167 views

need a help for modify .htaccess rule [closed]

here is my wp .htaccess # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /wordpress/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond ...
2
votes
1answer
202 views

Custom taxonomy on permalink

I have a long time problem and look forward for your help. I have a custom taxonomy of "city" (it is no hierarchical like tags). I just would like my URLs to look like this: ...
2
votes
2answers
80 views

When is it a good idea to build a permalink structure from scratch?

Is it a good idea to design a permalink structure from scratch? The requirements to the structure are as follows: Pages to be referenced by their structure ...
1
vote
1answer
2k views

Custom post type permalink endpoint

I have a custom post type called "destinations" and I have set the EP mask for the post type to default EP_PERMALINK. I have added a couple of endpoints as follows : add_filter( 'query_vars', ...
1
vote
3answers
571 views

Where, When, & How to Properly Flush Rewrite Rules Within the Scope of a Plugin?

I am having a bit of a strange issue with rewrite rules not flushing properly. I have tried using flush_rewrite_rules(); and flush_rewrite_rules(true);. I have also tried globalizing $wp_rewrite ...
1
vote
4answers
2k views

Wordpress not respecting template hierarchy (fetches index.php instead of single.php or page.php)

I've encountered a strange error while developing a custom theme. After finishing editing the template for a custom post type single view, I passed onto working at the template files for pages and I ...
1
vote
3answers
714 views

How to add .htaccess code through a function?

I need to add the following .htaccess code through a function <IfModule mod_deflate.c> # Insert filters AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html ...
1
vote
1answer
516 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 ...
1
vote
3answers
809 views

Custom Post Types: pretty search URLs and has_archive

This is a question based on the comments from the answer here. I'm using the following code to create a couple of different search boxes for my website: <form action="<?php echo home_url( ...
1
vote
1answer
1k views

add_rewrite_rule: $matches var not replaced by captured value

I want to access a plugin file (when <a> is clicked) without exposing actual path of the file. I am using the following rewrite rule: add_rewrite_rule( 'continue/([0-9]+)/?$', ...
1
vote
1answer
1k views

Priority for Categories, Tags, Taxonomies, Posts, Pages and Custom Posts with same url

I have been reading dozens of posts and honestly, I have many doubts on how this work. Furthermore, I think that with WP3.1 more issues have been added here because I am having even more problems now ...
1
vote
1answer
50 views

flush_rewrite_rules() cancels the effect of add_rewrite_rule()

As one of my plugin's features, I'm trying to define a custom url structure, like http://www.mysite.tld/foo/{action}. I'm using add_rewrite_rule() along with flush_rewrite_rules() on plugin ...
1
vote
1answer
85 views

'rewrite_rules_array' or 'generate_rewrite_rules' for adding custom rewrite rules?

Is there any reason why I should use rewrite_rules_array instead of generate_rewrite_rules? generate_rewrite_rules works out of the box, but I couldn't get rewrite_rules_array to work. And I am told ...
1
vote
2answers
73 views

Wordpress Rewrite

I'm trying to get http://example.com/site/vendors/?u=abc to rewrite to http://example.com/site/vendors/abc but I can't for the life of me figure out how to get the url rewrites to work. /site/ is the ...
1
vote
1answer
2k views

Can a custom post type have a Parent Page?

I've seen a lot of posts out there in the Webiverse about assigning a page as a parent of a custom post type. After four hours I can't find a solution and need some help. I've create an "About" page ...
1
vote
1answer
245 views

Can't add external rewrites

I've got the following code in my functions.php function add_custom_rewrite_rules(){ add_rewrite_tag('%gallery%','([^/]+)', 'gallery='); add_rewrite_tag('%album%','([^/]+)', 'album='); ...
1
vote
2answers
2k views

Custom post types and custom variables — add_rewrite_tag() question

I'm stuck on this, and have no idea what I'm doing. I have a custom post type called areas, that is hierarchical. We want to pass a variable into the page, and have it be pretty. Currently, it is: ...
1
vote
1answer
1k views

How to fix pagination after rewriting url? ie. www.site.com/players/type/pro/page/3/

I have a custom post type of players, and archive-players.php lists them all at an address such as www.site.com/players. I'm then using a url like www.site.com/players?type=pro to list another page ...
1
vote
1answer
20 views

Do I need to flush rewrite rules when creating new user if using custom author rewrite rules?

I am using custom urls for my author pages like this: http://site.com/author_name After I create a new user, that author page appears as not found; however, if I update my permalink structure from ...
1
vote
1answer
195 views

Why doesn't flush_rewrite_rules run on plugin activation?

I'm trying to flush rewrite rules in a plugin and it isn't working. I have to go to permalinks -> save in the admin panel for the rewrites to flush. Can anyone see why? class SpektrixPlugin { public ...
1
vote
1answer
2k views

How to Rewrite Wordpress URL for a Plugin

I am trying to build a Wordpress plugin here with a custom user admin area. What I would like to do is when the user adds /edit at the end of the page, it should open a page from my plugin. So for ...
1
vote
1answer
227 views

How does WP handle multiple matching rewrite rules?

Here is my url to a custom type : http://host/movie/my-slug When I go to this link, I'm redirected to http://host/movie/my-slug/?post_type=movie which results in a 404 error. I use Rewrite ...
1
vote
1answer
283 views

Force a specific template based on the URL

When a user browses to a URI beginning with "/forums", WordPress should call a specified template. For example, all of these URLs: mysite.com/forums mysite.com/forums/questions ...
1
vote
1answer
353 views

remove_query_arg() on rewrite rule

I'm attempting to add a Back to Search Results link which in essence will simply link back to the starting search page - for example /?s=test. I've taken a look at the global query vars and do see ...
1
vote
1answer
99 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 ...
1
vote
3answers
555 views

flush_rewrite_rules not working on plugin deactivation, invalid URLs not showing 404

i'm just about to release a community plug-in and have a few last anoying issues. First, whenever i visit a page that would not be valid for the plugin, www.mydomain.com/forms/tester it will take me ...
1
vote
2answers
758 views

Where do I USE add_rewrite_rule?

I need to add a RewriteRule to my site. I have tried in .htaccess with no luck, it doesn't get parsed, so I'm all but giving up on that. I found the documentation on add_rewrite_rule, but have no ...
1
vote
1answer
30 views

Performance impact of rewriting WordPress URLs

I'm currently rewriting author URLs in WordPress. I've removed the author base slug /author/. Please note I have total control over page slugs so can guarantee there will be no conflicts. I've added ...
1
vote
1answer
30 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 ...