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
2answers
1k views

add_rewrite_rule to remove /category/ from permalink

Hi I have many permalinks across my site that looks like this: http://www.mysite.com.com/market/category/slug/slug/slug/ http://www.mysite.com.com/market/category/slug/slug/ and would like to hide ...
1
vote
1answer
23 views

Plugins rewrite rules the right way

I need to create rewrite rules for my plugin. This plugin will be running on a very large WordPress Network (+2000 sites) so performance is important. Most tutorials and the codex recommend to ...
1
vote
1answer
128 views

Rewrite rules and query for virtual page

My question comes from this one. I have never really touched on rewrite rules as frankly, they still do not make sense to me What I have I have successfully build the following link ...
0
votes
1answer
14 views

Rewrite Rule added but showing 404 rather than specified page

I have the following rewrite rule function coaching_apply_rule() { add_rewrite_rule('^coaching/apply/', 'index.php?page_id=5156', 'top'); } add_action('init', 'coaching_apply_rule'); Reason for ...
0
votes
0answers
21 views

Update broke rewrite rule

With the update from 4.4 to 4.4.1 somehow suddenly my rewrites aren't working anymore. I've written a plugin to show attachments on a page (the landing page specifically) so people that come to the ...
0
votes
1answer
19 views

query_vars empty when using custom url with custom rewrite rule

I'm trying to pass custom url parameters to pretty urls using add_rewrite_tag('%product%', '([0-9/]+)'); ...
3
votes
1answer
135 views

Dynamic Endpoints

I have a database table outside WordPress that I need to make endpoints for. I've created a page /cars/ where I plan on using a page template to generate links. I would like for the url to look like ...
3
votes
1answer
1k views

add_query_vars and add_rewrite_rules

I am looking for some clarity on what add_rewrite_rules does. If I type in, or submit variables from a form, is it supposed to change the query variables to the pretty url? Currently when I type in ...
0
votes
1answer
510 views

Wordpress monthly archive links result in 404

When I use the archive widget in a sidebar, it creates the normal monthly post archive listing like the following: February 2014 January 2014 October 2013 and so on. Whenever I click on these ...
0
votes
1answer
526 views

Simple page URL rewrite with add_rewrite_rule()

I've check on previous post but my problem seems to not be covered by answers. I have a WP install into a subfolder www.example.com/sub-folder/ and a page password protected ...
0
votes
3answers
477 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' ...
-1
votes
1answer
424 views

404 Error On Custom Taxonomy Pages 2, 3, etc

I've been reading a bunch of posts about this with no luck so far. I can't seem to figure out what is the problem. I have the following: Custom Post Type: Sermons Custom Taxonomy: Series My urls ...
0
votes
1answer
402 views

permalink and add_rewrite_rule - error 404

I'd like to have comments in a separate page with a dedicated template only for posts in a specific category (slug shops). Example: mysite.com/post-incatshops --> mysite.com/post-incatshops/comment ...
0
votes
0answers
21 views

Dynamic variable in add_rewrite_rule

I'm trying to insert dynamic part of URL in add_rewrite_rule() when activating plugin. I have a config array $config = array('rewrite_key' => 'whatever'); and a function which do some stuff ...
0
votes
1answer
30 views

Rewrite URL - insert custom variables as a directory path

I'm trying to re-write permalink structure with my own custom url in wordpress for a Divi Theme "project" I have already changed the "Divi slug" from "project" to "prodotti" so currently the url ...
0
votes
1answer
553 views

add_rewrite_endpoint not working

I've been having looot of troubles with this function, I don't know what to do, because I tried everything. I have a custom post type, let's call it study. The url structure for it is ...
4
votes
1answer
1k views

Adding meta values to permalink

I have publications and I want to simply add year and month to the permalink. Currently the year and month of publication is added to the post as a meta value. I've set up publications as a custom ...
0
votes
0answers
16 views

Permalink structure between 2 custom post types and a taxonomy

Ok here is the scenario. I have a custom post type called "Communities", a custom post type called "Community Posts" and a taxonomy under "Community Posts" called "Communities". The idea here is that ...
0
votes
1answer
28 views

Rewrite rules for short URL

Requirement I have implemented Document Short URL to allow people to access PDF documents on the servers using their unique IDs, without knowing their full paths. Documents are PDF files, so they ...
0
votes
0answers
33 views

Custom permalinks for search with extra parameters

I am trying to change default WordPress permalinks for search because I added few parameters to search.php the url now is like: ...
0
votes
1answer
16 views

How to change URL structure for pagination pages?

Hi I'm new to WordPress hence if my question was simple or stupid I'm sorry, but please someone tell me how to change URL for pagination pages. Currently I'm having URL for pagination pages as: ...
0
votes
0answers
19 views

add_rewrite_rule -> filter posts and custom taxonomy

Hello I want to add a custom permaling structur and based on that use a specific template for displaying posts: For example i have: category=football category=baseball and custom taxonomy ...
1
vote
0answers
17 views

how to change permalinks format for pagination?

Sorry if my question was basic or stupid. Please help me how to do this in wordpress, i m new to wordpress. I have permalinks for pagination page like this www.website.com/customtaxonomy.html/1 ...
0
votes
2answers
36 views

add_rewrite_rule() driving me crazy, rewrite not working when analyzer says it should

I have a special situation and need some help achieving the final step. Background: When I access mydomain.com/category/postname, I get the post as expected. When I access ...
0
votes
0answers
12 views

rewrite rule added to function.php not work

Hello in my custom plugin i want to set custom rewrite rules. First i trying make this with one rule, so i create functions.php file in my plugin folder and i paste into this code: function ...
0
votes
0answers
18 views

Pagination redirection in WordPress

I had a blog website in a custom CMS. I recently re-developed the website in WordPress. The old website had pagination urls like "?page=2" But WordPress shows pagination urls like "/page/2" Now what ...
0
votes
0answers
26 views

Add conditional rewrite rule depending on user agent

My problem is the following : I'm buiding two wordpress themes with an angularjs app inside each of them. One theme is desktop, the other is mobile. The theme switch is made by this plugin : ...
0
votes
0answers
21 views

WP Rest API blog with detail page

I've a blog on a other site, and with the WP Rest Api I want to show the excerpts on a other site, with a custom single page. I've made a page_blog.php page where I show the posts, and now I want to ...
0
votes
0answers
20 views

Add Rewrite Rule giving 404 Error

I'm having a little problem with Wordpress add_rewrite_rule function. I'm trying to accept a user subscription by using the URL from the email I've sent. The hash I use is generated from ...
0
votes
1answer
24 views

add_external_rule - rules deleted when visiting permalinks page

In my plugin, I have the following function hooked to register_activation_hook. The rules are added correctly. public function add_rules(){ global $wp_rewrite; ...
1
vote
1answer
58 views

Rewrite rule to prettify two $_GET variables while in a new endpoint from a page

I'm trying to create a permalink rule which is a few levels deep. I have a basic page /page-slug/ - I'm appending to it a new endpoint: /page-slug/my-endpoint/ - from here I need to nest one id and ...
1
vote
1answer
29 views

Enpoint Not Found in Rewrite Tag Permalink

I'm trying to make an XML feed show nice and pretty permalinks rather than showing query strings. The problem is I can't get my /products/ endpoint to show up when trying to process my custom rewrite ...
1
vote
1answer
47 views

Rewrite Wordpress URL to show CPT meta field data

I'm stuck in need of a rewrite rule. I have set up a custom post type for 'Books', each book has a repeatable field (using ACF Pro) for chapters. I have added a query_var for chapter using the code ...
0
votes
0answers
31 views

Wordpress URL Rewrite is removing special characters

I'm having a little problem with Wordpress's built-in add_rewrite_rule function. It's quite simple: I have a newsletter form, which sends a confirm mail to users, with a confirm code. Let's say that ...
0
votes
1answer
32 views

Rewrite gets completely ignored

I have created a small function to rewrite a get variable. First, I created the page 'download', and I want a get variable to be used for the file attribute. This is an working URL: ...
0
votes
2answers
32 views

Rewriting in wordpress url

Yes we love to make the url more shorter ,more clean. Lets say we have css url like this xxx.com/wp-content/theme_name/css/my_custom_css.css However i would love to display it like this ...
0
votes
0answers
36 views

add_rewrite_rule questions

I've read several tutorials on the subject, but am not seeming to be making headway here. Ultimately, I am trying to write the following url: example.com/parts/by_model/YEAR/MAKE/POST-NAME/# Where ...
4
votes
1answer
129 views

Why does everybody hook add_rewrite_rule on init

Every example I find of adding rewrtie rules looks like function addsomerule() { add_rewrite_rule(some regex,some parse result); } add_action('init','addsomerule'); This doesn't compute for me. ...
0
votes
1answer
101 views

Rewrite Rule for Custom Page with Query Vars in URL

Background I have a a page called 'listen' with a custom template, which runs a custom wp_query that uses the 'show' variable in the URL. The following example works... ...
0
votes
0answers
42 views

add_rewrite_rule using custom taxonomy and year

I have a CPT called books and a custom taxonomy called genre and need to show in a page all books of a specific term and a specific year. For that, I created taxonomy-genre.php file and created a ...
0
votes
0answers
28 views

How to generate Short URL for my documents in Wordpress

Scenario I have a custom table with documents. This table have other fields but couple of them only relevant to my question are ID, and PATH. Majority of documents stored are PDF files and ...
1
vote
0answers
83 views

Multisite theme path rewrite using .htaccess

I'm trying to rewrite the theme path for multiple domains (wordpresss multisite) using separate themes, this is my current .htaccess file, this is allowing each site to use seperate CSS files but not ...
1
vote
1answer
59 views

WordPress rewrite rules for state and city

I'm building a site where every state and city in the US has a landing page. I have a database of every city, state, and zip code, set up as a custom post type in WP. Here's what I've done ...
0
votes
0answers
24 views

Rewrite URL Category + Tag

I want to rewrite some URL's in my Wordpress site. The idea is to change URL's that has been generated by a search form across custom categories and custom tags. For example: ...
0
votes
1answer
27 views

add_rewrite_rule to pass entire path as a single parameter

I want to rewrite an url and pass the whole path as a parameter. Something like: www.example.com/csearch/foo1/bar1/foo2/foo3/bar4 => ...
0
votes
1answer
43 views

rewrites and custom links in page need help with add_rewrite_rule

I have one page with edited permalink, like, address.com/detail/ I need to send there some values by GET request, so i would like the link looks like /detail/value1/value2/ i added this code in ...
0
votes
0answers
29 views

Mixed CPT permalink structure

Im working on a site and i would need to add new features to the The Event Calendar plugin. The plugin uses tribe_events for event CPT and tribe_events_cat for Event category taxonomy. I need ...
0
votes
1answer
54 views

add_rewrite_rule doesn't work for me

I'm trying to use add_rewrite_rule to make custom URL. My problem is the same as here : Custom Rewrite with Query vars But I tried the 2 solutions, and it doesn't work for me. For testing, I ...
0
votes
1answer
92 views

Adding custom slugs: parent-page/username/child-page/

I'm in a bit of a muddle understanding how I can change my $_GET variables into a 'slug'. I already have a setup of a parent-page/child-page using wp_insert_post. BUT! I want to add a variable ...
0
votes
0answers
15 views

Provide a Special URL with Parameters

I need to provide some Data in JSON on multiple special URLs. The URL should look like this: example.com/mobile/get_event_list?ts_loc=1435576599 or, more general ...