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

0
votes
0answers
26 views

WP_rewrite static Page URLs

Just moved over from blogger to wordpress. To try and maintain old URLs, and respective comments etc I've changed the site URL in the wordpress settings to match the old blogger format which was ...
0
votes
1answer
140 views

Rewrite and replace url wp-admin/edit.php and wp-admin/post-new.php

everybody I want to rewrite and replace all url mydomain.com/wp-admin/edit.php -> mydomain.com/wp-admin/edit/ and mydomain.com/wp-admin/post-new.php -> mydomain.com/wp-admin/addnewpost/ How i ...
0
votes
0answers
101 views

add_rewrite_rule not working in Wordpress Multisite

I need to rewrite urls on a Wordpress Network/Multisite, so I wrote a plugin that does it for me. This plugin works perfectly when using on a Single Wordpress site that does not make use of the ...
1
vote
1answer
22 views

How to always rewrite author archive page URL even if the author does not have a post

My understanding about author archive page URL rewriting is that as long as the author has atleast one post/page the URL for the archive page ofthe author will be re-written to: ...
0
votes
0answers
43 views

flush_rewrite_rules vs $wp_rewrite->flush_rules

I have been trying to flush the rewrite rules whenever admin chooses to change some value which needs rewriting. I first tried flush_rewrite_rules(true)(hard flush) which didn't work. Then I tried ...
0
votes
1answer
39 views

How to rewrite CPT-Permalinks the correct way (incorporating meta-box-data)?

Using the below hooks, I tried to rewrite the permalinks of my custom post type magazine_issue to be made of values of additional meta-fields I added to the edit screen. The problem with my actual ...
-1
votes
1answer
315 views

How to redirect image attachment to its original post

I'm making a slider that is getting images from attachments in the post. I am trying to rewrite the url for the post so that if someone pastes the direct url to the attachment, it'll go the post ...
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 ...
3
votes
1answer
79 views

Prepend meta_value to permalink of post

I have 2 custom post types movies (non-hierarchical) and series(hierarchical). Each post from seriestype has a meta field _movie which contains a movie ID. I want to specify a custom permalink ...
0
votes
0answers
58 views

WP redirects pretty permalink to query string

I have a custom post type artist and a taxonomy kind_of_art. I want their permalinks to be like: %kind_of_art%/%artist% Therefore I created following rewrite rules: add_rewrite_rule( ...
0
votes
2answers
51 views

How to get the parameters on page and avoid 404?

I have a page like http://mydomain.com/mypage and I want to set some $_GET parameter like that: http://mydomain.com/mypage/firstparameter/firstvalue I need "firstparameter" value but I always end ...
0
votes
0answers
30 views

Custom Rewrites not used by WordPress

I've set up a simple plugin that adds custom rewrite rules to WordPress. Here is the code for that plugin: https://gist.github.com/JCPry/7324825. A page is created within WordPress with the slug ...
1
vote
1answer
43 views

Is a permastruct possible on pages?

Since a couple of weeks I'm trying to create my own rewritings on pages. I read a lot about rewriting with posts and custom post-types. BUT: I have pages that I call with variables. How is it ...
0
votes
0answers
24 views

How to map sub-directory to second wordpress multisite?

I have setup a two sites using one wordpress installation. The issue that I have now is that I can only access each site via /blog/ and /blog/support/. I want to access the support section using ...
5
votes
2answers
3k views

Change the “page” slug in pagination

Simple question. When pagination is activated, the URL changes to "site.com/page/2". For my site, this should be "site.com/paggetto/2". How can I change that rewrite rule? I also want to change ...
1
vote
1answer
109 views

Multiple Permalinks for Same Post

I'd like to be able to have multiple permalinks for the same underlying post (for i18n reasons) - eg http://www.example.com/my-custom-post-type/this-is-a-cool-article ...
0
votes
3answers
45 views

Why isn't my rewrite rule working when there is no second parameter?

Here is my rewrite rule code: add_rewrite_rule('tides/([^/]+)/([^/]*)', 'index.php?page_id=4348&location=$matches[1]&month=$matches[2]', 'top'); add_rewrite_tag('%location%', '([^&]+)'); ...
1
vote
1answer
54 views

Using WP Rewrite, but just not “getting it”

I'm trying to use WP Rewrite to avoid having to enter anything into an htaccess file. So far, I have this one working just fine (it loads a post from a Custom Post Type): $leader_structure = ...
0
votes
1answer
174 views

Wordpress custom permalinks, pages are now 404

I've set my permalinks to a custom structure: /%menutype%/%postname%/ This works all right for my custom taxonomy (menutype) and anything that's an archive. Now however, simple pages won't work, ...
1
vote
1answer
50 views

add_feed and flush_rewrite_rules

There seems to be quite a controversial opinion on the WordPress flush_rewrite_rules() function. According to the Codex, it is highly discouraged to use this function on the init action hook. ...
0
votes
0answers
58 views

Overwrite custom post type (WP SEO Local)

Site I'm working on right now is using WP SEO Local plugin (Yoast), it makes a custom post type for the locations, and they all get a custom slug. Let's say my slug is /locations/ So all the ...
0
votes
0answers
38 views

Rewrites for taxonomy and custom post type

I am getting my head around the Wordpress Rewrite API and it's plethora of options! What I have managed to do so far is ensure that my product category does not have the preceeding "productcategory" ...
0
votes
1answer
46 views

Custom slug in url for CPT and taxonomy

I want to add a custom slug to permalink for CPT and taxonomy. Like this: http://mydomain.com/my-custom-slug/post-slug http://mydomain.com/my-custom-slug/product_category Here is my CPT and ...
0
votes
1answer
133 views

WP is ignoring .htaccess rewritten URL

I have two domains being served from the same WP install. edit: not multi-site In wp-config.php I have define('WP_SITEURL', "http://$hostname/wordpress"); etc. The two domains will have similar ...
0
votes
1answer
153 views

Use date in the URL of custom post type

So I've created a custom post type, say reviews, and its archive is available at <domain>/reviews/. I want to categorize them by date. So every day (or week) I publish a reviews type post and I ...
0
votes
0answers
26 views

Rewrite URL based on form input

I have a form: <form action="<?php echo get_permalink(); ?>" method="get"> <select name="genres[]"> <option value="jazz"></option> <option ...
1
vote
3answers
566 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 ...
0
votes
0answers
70 views

How to make a custom route with any-string-part/number-part pointing to an existing page?

I've got a page with my own widget inside of it which needs some params from the url to produce dynamic db results - don't worry everything is sanitized well and I only let this part out to keep this ...
1
vote
1answer
155 views

How to set up Author archives with sub category URL

So i have a site where i have used the authors.php page so that i can display individual user's profile pages.. the url then looks something like: http://mydomain.com/author/test/ What i would like ...
0
votes
0answers
217 views

add_rewrite_rule not working

I'm trying to do some url rewriting. I've picked this example right off the wordpress wiki here: add_rewrite_rule('^nutrition/([^/]*)/([^/]*)/?','index.php?foo=bar','top'); The wiki page says: ...
1
vote
1answer
51 views

Make custom post types and pages place nice, re: rewrite

I have a page structure like such: Executive Events Annual Conferences Webinars I also have a custom post type named 'event'. I have set up the post type so that I get exactly the permalink ...
0
votes
1answer
110 views

Rewrite Rule & Regex - Extract 'cat-name' and 'page-number' from http://domain.com/custom-post-type/category/cat-name/page/page-number

I have an URL formatted so: http://domain.com/custom-post-type/category/cat-name/page/page-number I need to extract: cat-name and page-number So that in my functions.php, I can create the custom ...
1
vote
0answers
28 views

Custom Permalinks for Custom Taxonomies/Post Types -> Top Level Pages not working [duplicate]

I have created a custom post type called "artists". These are categorized by the custom taxonomy "style". I do have this: ./photography/edward-example (single page with details) ...
0
votes
1answer
109 views

Custom rewrite rules for feeds of custom queries (query_var query strings in URL)?

Question updated. What I'm trying to do If I want to display posts (or a feed of posts) that belong to a category AND a custom taxonomy, or a category AND a tag, or a custom taxonomy AND a tag, I ...
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 ...
3
votes
3answers
2k views

Need help with rewrite_rules_array

I have a page that I access at /category/tasks and the file is located at wp-content/themes/my-theme/tasks.php. I would like to make it so I can add a flag after tasks and pick up the query strong in ...
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 ...
3
votes
1answer
48 views

Blog installed in subdirectory but need to create pages in root. How to use permalinks?

Our companies blog is installed in /blog. Our permalink structure is /%postname%/ so posts currently look like https://www.domain.com/blog/post We've been asked to publish a series of guides which ...
0
votes
0answers
23 views

Post Type Rewrite Custom

Demo for example: my-site.com/shop-virtual/ - Listing all posts of Post type "Products". my-site.com/shop-virtual/products/category - Listing all posts of Category. ...
0
votes
1answer
64 views

URL rewrite in theme doesn't seem to be working

so I was asked to create url rewrites for one of the websites we're working on, but the thing is the test rewrite I did, just to try it out, is not really working. here's the code I put in the ...
0
votes
0answers
56 views

rewrite rule for home/index page

I've been struggling for a while already and all of my attempts failed so I have no other choice but to ask for help here... a) I've made a custom post type page_blox whose capability_type => ...
0
votes
0answers
21 views

Custom Post Type rewrite with Custom Taxonomy and Custom Meta!

I have a custom post type called 'photos'. I have a custom taxonomy called 'series'. Each post will have a custom meta item called '_photo_number'. I want my URLs to go something like this: Single ...
0
votes
0answers
123 views

Only homepage working correctly, 404 error on everything else

I've been developing wordpress based websites for some time now, and i built one for my company's own brand, it worked with no problem at all for ages, but now for some reason, i can only get the ...
0
votes
1answer
41 views

How to create custom content on custom page from plugin?

I have a plugin that I'm working on and I'd like the plugin to create and display custom content on a "page" created using a rewrite rule. I've successfully created the rewrite rule with ...
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: ...
0
votes
1answer
140 views

WordPress keeps writing rewrite rules to .htaccess

WordPress keeps writing rewrite rules into .htaccess again and again till it causes an error and causes server to return 500 Internal server error... i.e. My .htaccess is a series of # BEGIN ...
2
votes
2answers
140 views

flush_rewrite_rules() not working on plugin activation

I am experimenting with creating a simple plugin to create a custom post type named project but am having some trouble with the rewrite rules not been flushed on activation. I have the main plugin ...
0
votes
0answers
36 views

Rewirte the theme URLs

I was trying to implement the rewrite system of Roots on my theme. I followed this tutorial. In my functions.php I put the following: include_once(THEME_LIB . '/rewrites.php'); And created the ...
2
votes
1answer
242 views

WordPress Custom Post Type Category Page

I was hoping someone could help me. I have done some serious googling but cannot find the answer for this one. I have a custom post type called tutorials. I can go to mysite.com/tutorials and get a ...
1
vote
3answers
219 views

Flush Rewrite Rules when new site is created on network

I am working with a multisite setup and I have created some custom post types, which seem to work fine except when trying to view any of the post types pages on the front end, I get a white screen. ...