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

1
vote
1answer
6 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 ...
0
votes
0answers
17 views

How to get list of taxonomy slugs ordered parents>childs?

Is there an existing function in WordPress to generate a list of taxonomy slugs ordered by parents > childs > subchilds in an array? I need to generate a URL structure for my custom post type in ...
0
votes
0answers
9 views

Attempting to modify cpt archive with query var

I have a custom post type, messages (slug is watch), and I added a query var, speaker, as well as the rewrite. If the url is /watch/speaker/Speaker+Name it modifies the query to include that. If it's ...
0
votes
1answer
19 views

Add Custom Pagination Permalink

I'm trying to create a page with multiple loops on it and as such also need multiple pagination. This is proving to be a touch difficult, I've managed to get the links to show correctly by using the ...
1
vote
1answer
16 views

Custom post type permalink returns 404

Mates, I've created a custom post type. Created some posts of that type, but when I try to access to any of them, I get 404 error. Also created single theme (single-pb_progproy.php). Here's the ...
0
votes
0answers
15 views

PHP Rewrite Wordpress Folder to act as query string variable throughout site

I'm hoping in this is a possibility with Wordpress and I have been researching this for hours online and I'm not find a definitive or simple working example of how to achieve my goal. I need ...
0
votes
0answers
13 views

rewrite rule of post when accessed from archives pages

Im trying to rewrite the slug of the permalink of my post when accessed from my archives pages. at the moment it display like: www.mydomain.com/categorypost/post_title id like instead ...
0
votes
1answer
17 views

Multiple Custom Post Type permalink issue

I have 2 Custom Post Type(Our Works and Case Study) in a WordPress site. If I add same postname(Pepsi) at my 2 Custom Post Type(Our Works and Case Study) the permalink will show given below: 1) ...
0
votes
0answers
7 views

Remove final slash from url

I created rewrite this rule: public function manage_user_routes() { add_rewrite_rule( '^user/([^/]+)?', 'index.php?control_action=$matches[1]', 'top' ); } but when I try to access ...
0
votes
0answers
35 views

add_rewrite_rule set up correctly, why does new URL show 404?

My aim is to have the following URL structure: /text-string/text-string/directory/text-string/text-string/1234/ point to page 447 with parts of the URL passed as get variables. (I am not worrying ...
2
votes
0answers
47 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
0answers
29 views

Custom post type slug rewrite blocks pagination - how to solve this?

I have run into a problem while doing what was given as a solution in the following thread: Remove Slug from Custom Post Type Namely, after all of this being done, my pagination no longer works. As ...
0
votes
0answers
28 views

rewriterule problem

I'm struggling to get a rewrite rule to work: I have a Wordpress 4.0 site sitting in a subfolder of a top domain with a url similar to this: ...
0
votes
1answer
38 views

Modifying rewrite rules to use <custom post type>/category/<custom taxonomy term>/

I know I can add a rewrite rule to accomplish this but I'd like to affect the links generated by WordPress (such as when I put a custom taxonomy term into a menu) I have spent the entire day today ...
0
votes
1answer
71 views

HTTPS to HTTP rewrite rules not working as expected

I'm struggling at getting these rewrite rules to work and was wondering if someone can point out my error(s). The following should redirect a user to HTTPS if they are at the login page or in the ...
0
votes
1answer
16 views

Remove rewrite endpoint on deactivation?

I'm using Milo's answer to add a Rewrite Endpoint as part of my plugin. Is there a straight-forward way to remove a Rewrite Rule upon deactivation? I found this snippet but I'd expect a ...
0
votes
0answers
17 views

How write rewrite rule to reroute tiny url?

I want to know how to write a regex : for exemple url: http://localhost/wordpress/post-title/lang/en become http://localhost/wordpress/post-title/en. I need a global rule for all types of posts? ...
0
votes
0answers
44 views

Clean/Pretty URLs in Wordpress Using Custom for Custom Variables ($_GET)

I have a Wordpress page that I am passing custom variables to; I was able to successfully get this page to accept the custom variables using the following: function add_query_vars($aVars) { $aVars[] ...
0
votes
1answer
10 views

Adding a custom rewrite rule for gallery/categories page

I've written a simple shortcode and using it on my gallery page. The URL for the page looks something like this: http://mysite.dev/gallery/?view=category-name but I want to be able to use ...
0
votes
0answers
11 views

Custom Rewrite Tag Structure

I am pondering over this intriguing question and I have yet to find an answer. I need to add my own Custom Structure Tags for my cpts. Extract fromt he link above: %year% The year of the post, ...
0
votes
0answers
33 views

Custom Post Types and rewrite rules - One CPT works and a cloned one doesn't

I have two Custom Post Types in my plugin and have a custom single-{cpt}.php file for each in my theme. Each page grabs the content from a specific wordpress post. The first 'house' post works but the ...
0
votes
0answers
63 views

Custom post type empty slug breaks permalinks for pages

In attempt to avoid posting a ticket to essentially reopen #15082 I'm posing here first. I have been vigorously dealing with this CPT permalink rewrite for countless hours now. After a 3am kinda night ...
0
votes
0answers
134 views

Archive page for a custom post type using WPML

On a website using WPML in last version, I have a Custom Post Type using an archive page, called archive-agenda.php. CPT is defined with this code : register_post_type('agenda', array( 'label' ...
1
vote
1answer
74 views

generate_rewrite_rules (action) vs add_rewrite_rule (function): which one is preferred?

I see these two methods can be used to create new custom rewrite rule, so under what situation which one is preferred? I suppose they are doing the same thing? I can either use: add_action( ...
0
votes
3answers
75 views

wrong template for page of archive

I am trying to add pagination to the archiveof my custom post type. Right now it is structured by year & month and I want to add pagination and I fail miserably. So its like this: <!-- ...
0
votes
0answers
23 views

Prevent guessing slug

I have the following rewrite rule function add_rewrite_rules($rules) { $new_rules = array( 'buscador-latte/(.*)/?$' => 'index.php?page_id=866&search_parameters=$matches[1]', ); ...
0
votes
0answers
26 views

Rewriting base name Taxonomy same Post Type

I have a Custom post type called "events" and taxonomy called "cat-events". I'd like this structure: website.com/events/ website.com/events/post-name (es: website.com/events/the-best-musical-2014) ...
0
votes
0answers
26 views

Custom Post Type rewrite permalink

I am trying to rewrite permalinks for my custom post type. The structure I look is: /%custom_post_type%/%custom_taxonomy%/%date%/%postname% Any ideas how can I achieve that?
0
votes
0answers
16 views

Rewrite Rule To Own File

Is it possible to add a rewrite rule to redirect to a page other than index.php? For example: add_rewrite_rule('([^/]*)/preview/?','preview.php?page_title=$matches[1]','top'); The above code only ...
1
vote
0answers
60 views

Rewrite rule for path of favicon.ico ( Add_rewrite_rule function possible ? )

Hi Wordpress developers ! I'm wondering, is it possible to make by PHP and power of Wordpress following: If user access http://localhost/favicon.ico, is it possible to make show user data from ...
0
votes
0answers
21 views

Wordpress internally rewrite rule challenge

Questions 1: I work on wordpress website for a client. But the client like to have a deep level url structure. The custom post type can be from level 1 to unlimited levels in the url structure. ...
0
votes
0answers
48 views

htaccess url rewrite within WP installation

I want to use one of my subdomains to rewrite urls and finally forward to an origin extern domain. Example: goto.mydomain.com/1saKCA3 -> externdomain.com/1saKCA3 I already tried to implement the ...
0
votes
0answers
10 views

Creating custom rewrite rules for site sections

I have a WordPress site with several custom post types. I would like to group them by a URL prefix. Maybe something like this: www.example.com/ prefix_one/ post_type_one/ ...
0
votes
2answers
51 views

Best way to redirect site in subdirectory to root?

I have a WP 4.0 site that has been installed at: mydomain.com/site It's been there for many years, so there are lots of links from around the web pointing to it. As part of an overhaul I am doing, ...
0
votes
1answer
33 views

How does WP determine the difference between a post and a page url

I'm trying to mimic WP routing in a javascript plugin. I've successfully imported the rewrite rules and am applying them to the browser location. But I can't seem to parse the difference between a ...
0
votes
0answers
35 views

SOLVED - Rewrite of custom taxonomy displayed on a page

I have a custom taxonomy "product-category". All parent terms are displayed and linked on a page myurl.com/directory/ with some custom code. Example link: /directory/accessories This gives me a 404, ...
2
votes
1answer
79 views

Can someone explain the function of the third parameter of “add_rewrite_tag”

Can you please explain the third function parameter queryreplace of add_rewrite_tag. Explanation with code examples will be much appreciated. UPDATE i wrote this code below to make a page with slug ...
0
votes
2answers
31 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

Difference between flush_rewrite_rules() and Settings > Permalinks

The issue I'm currently having is that I have 404 errors on all of my pages besides the home page. I can recreate this when I import and overwrite the WordPress database. Sometimes it happens after ...
0
votes
1answer
37 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() { ...
0
votes
1answer
71 views

Custom Endpoint For Custom Post Type from Child Theme

I'm working with a child theme. Main theme has a custom post type called "Place". I need to change that into "Location". However, I changed all levels using wp_post_types object. Now I need to change ...
0
votes
1answer
46 views

Flush rewrite rules on option update with Settings API

I'm working on some plugin where I need to enable custom URL rewrites. I want to enable editing of custom URL through Settings API, so basically I did everything that's needed to validate and update ...
0
votes
0answers
21 views

permalink problem in my .htaccess page

Please give me a suggestion for my question. when we set permalink in our site then the .htaccess code is RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond ...
2
votes
0answers
67 views

Reading Settings -> Front Page displays “Static Page” being reset

Every day my WordPress blog is going from a static page, back to "your latest posts". I am not setting this setting, something is doing this automatically! Any ideas what to check for? Is there any ...
0
votes
1answer
48 views

Change the custom post type permalink

I have projects category in my theme ( custom post type ). my link goes like this http://shaowtriger.com/project/naim/ my required link is http://shaowtriger.com/brands/naim/ I also ...
0
votes
0answers
25 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
1answer
62 views

Add_rewrite_rule doesn't seem to work?

I am trying to get my two custom post types to work properly. Let's say the two Custom Post Types (CPT) are books and reviews. now i like mydomain.com/books/the-great-gatsby/reviews/33 to show ...
0
votes
1answer
46 views

Permalinks using event date (year & month) instead of publication date

The site http://www.bikefun.org is live and working, but the permalinks are not quite right. It is an event calendar site. Events are stored as a custom post type "bf_events", with dates stored as ...
0
votes
1answer
43 views

Why won't this rewrite rule work?

Here's the setup. I have a custom post type 'Businesses'. I have a custom taxonomy 'Display Category'. And I have a second custom taxonomy 'Filters' Both taxonomies are set to work with the custom ...
0
votes
1answer
35 views

Where to hook to bypass instantiating WP_Query?

I'm a bit stalled in a plugin creation, as I do not find a way to elegantly hook things up. A strip down version of my problem is the following: Boot Wordpress completely (core and plugins) Detect ...