Tagged Questions

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

How to add rewrite rules adjust to permalink structure

I want to create an Archive Widget for Custom Post Type (product). I let my client to change permalink structure by himself. So, my question is: how to add rewrite rules adjust to permalink ...
0
votes
1answer
96 views

force_ssl_admin() causing issues with preview links

I have recently enabled my WordPress website to use an SSL Cert for administration/login pages. I am using the plugin W3 Total Cache with my Content Delivery network. I have noticed that when I am ...
1
vote
1answer
902 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
61 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
1answer
50 views

Rewrite Rules returning wrong data

I have a custom post type called product. It is categorized with the two taxonomies product_category (which is superior) and product_group. I want the permalinks for single products to appear like: ...
0
votes
1answer
106 views

Passing variables in the permalink structure on a custom post type

I have a structure like this for my custom post types: domain.com/member/member-name/book/book-name Basically, I have a custom post type of member, and the member-name is the post. What I want to do ...
0
votes
0answers
290 views

Multisite sub-directories IIS 7.5 change media/uploads location

I am running WP 3.8.1 Multisite. Sub-directories is configured. I have 10 sub-directory sites and 1 primary site. WordPress is running on a Windows 2008 R2 datacenter 64bit server with IIS 7.5. I have ...
0
votes
0answers
60 views

Custom Rewrite Rule with Sub Folders

I need to create a custom rewrite rule for a WordPress plugin. I have read this topic and came up with a working solution using add_rewrite_rule(). However, after testing the plugin, I realized that ...
0
votes
0answers
83 views

Page displaying but the inspector shows 500 Internal Server error?

I have setup custom urls for a wordpress based site, (not using wordpress pages or posts) but custom urls and including custom page templates. I have several urls working fine except one, page ...
0
votes
0answers
28 views

Create custom page from custom rewrite

I want to know how to create a custom page with a custom URL route, but I only found how to define a custom URL and custom route (rewrite URL) to any post-type. The problem is that I don't want a ...
0
votes
0answers
55 views

get_permalink is getting old rewrite rule

I had some rewrite rules in my functions.php file. I decided that I didn't need them, and removed all rewrite rules and then flushed them. However for some reason when I use get_permalink() the url is ...
0
votes
2answers
380 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
571 views

Parent cpt/child custom post type URL permalink relationship

I am attempting to set up a relationship in Wordpress between two custom post types I’ve created and display that relationship within each post type’s permalink URL structure. I have created two ...
0
votes
1answer
58 views

Custom post type rewrite with_front

What I'm setting up, I thought would be quite simple. In fact, I'm sort of amazed that the answer didn't just pop up after a half hour of searching here. Here is the code to create my CPT: ...
0
votes
1answer
82 views

Apache rewrite rules and wordpress problem

I tried to fix my problem by using wordpress rewrite rules but sadly it took me so long I tried this approach. I got it working for one of my simpler problems but now I can't get it to work for my two ...
0
votes
1answer
85 views

Wordpress URL rewrite problem

blog.com/product/somename In the above URL - how do I tell Wordpress that 'product' is a variable and 'somename' is its value. Then how do I extract that value and use it inside a function I'll ...
-1
votes
1answer
29 views

Why do I need to register my custom post type a second time when flushing rewrite rules?

If I register my custom post type when the init action fires (which is before plugin activation) why do I need to register my custom post type a second time when flushing rewrite rules (on plugin ...
0
votes
0answers
47 views

Permalink broken for pages after adding rewrite rule

After adding these rewrite rules: add_rewrite_rule( '([^/]+)/page/([0-9]{1,})?$', 'index.php?author_name=$matches[1]&paged=$matches[2]', 'top' ); add_rewrite_rule( '([^/]+)?$', ...
1
vote
1answer
111 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 ...
0
votes
1answer
172 views

Migration from old CMS to WordPress 301 redirection rules?

I need 301 redirection rule for migrating old CMS to WordPress. On old CMS I have URL structure like this: I wish is to move my site to WordPress and to have all old (or most) URLs with 301 redirect ...
0
votes
1answer
112 views

WP Rewrite the last two parts of the URL

I have found quite a lot of post on the subject of WP rewrite but I can't find the right words to describe this problem. I'm trying to accomplish the following: ...
0
votes
0answers
14 views

Rewrite rules for changing a custom page permalink with author details

I have the following page with permalink: http://mysite.com/custom_page/custom_var/author_name and I want it like this: http://mysite.com/author_name/custom_page The custom page conatins some ...
0
votes
0answers
91 views

Learning rewrite rules and custom permalinks. Paging not working

I am just starting to learn rewrite rules and custom wordpress permalinks. I have made a custom endpoint called autor with the following code: function my_query_vars($vars) { $vars[] = "autor"; ...
0
votes
0answers
250 views

Rewriting custom post type permalinks gives 404

I am using this code in my functions file to be able to include a post ID in my permalinks for a custom post type. But I am getting a 404 error when I attempt to preview view any of the posts of that ...
0
votes
0answers
40 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
0answers
242 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
33 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
161 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
67 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 ...
2
votes
0answers
83 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 ...
0
votes
0answers
121 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( ...
3
votes
1answer
122 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
125 views

How to make nested custom post type slugs work

I'll try to explain how I want this to work, rather than what I've done so far, as nothing seems to work. I want 3 custom post types: Products Consumables Accessories with the following slugs: ...
0
votes
2answers
84 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
34 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
94 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
30 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 ...
1
vote
1answer
271 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
69 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
77 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 = ...
1
vote
1answer
129 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
94 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
48 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
60 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
178 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
0answers
44 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 ...
3
votes
3answers
2k 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
163 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 ...
0
votes
0answers
502 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
65 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 ...