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

1
vote
1answer
37 views

How to change URL Custom Page?

My Page Custom URL: http://abcd.com/watch?name=video-title How can I change this url to http://abcd.com/watch/video-title where watch is a custom page? My functions.php code: function ...
2
votes
0answers
36 views

Case-insensitive add_rewrite_rules in Wordpress functions

Been hitting my head against the wall on this for a while. If I have a add_rewrite_rules like so: $aNewRules = array('my-books/?$' => 'index.php?pagename=my-books'); This works correctly; ...
0
votes
0answers
14 views

Partial matching issues in rewrites api

I'm working on a site that has a lot of custom rewrites. We started with: function em_rewrite() { add_rewrite_rule( '^state/([^/]*)/([^/]*)/?', ...
1
vote
1answer
17 views

Wordpress add_rewrite_rule() cannot visit lower url levels

I have a post type called "shop" and added query variables and a rewrite rule. // Adds query vars for shop post type function gtp_add_shop_query_vars( $vars ) { $vars[] = 'shop-category'; ...
0
votes
0answers
36 views

Page URL with variable (URL rewrite)

I'm new to this Wordpress & right now I tried to rewrite a specific page that have variable with it. First of all let me explain. I have a page that will retrieve all loggedin user info in a page ...
0
votes
0answers
22 views

wordpress rewrite and keep url for page

I am using the rewrite api with the following that works... add_rewrite_rule( '^ch/(\d+)', 'index.php?p=$matches[1]', 'top' ); The idea is that the ch identifies it as Chinese and the ...
0
votes
0answers
28 views

Taxonomy rewrite problem [duplicate]

I created new custom post type called "projekt" and taxonomy "kategorie" with rewrite "realizacje". What I need is create that structure: /realizacje/ - archive for all /realizacje/taxonomy/ - ...
0
votes
0answers
21 views

add_rewrite_rules

I'm moving an old blog from Typepad to WordPress and trying to maintain permalinks. I'm hoping to drop the /category/ base from category urls and add /index.html to monthly archives. I have these two ...
0
votes
1answer
15 views

Custom Post Type rewrite url to /category/pagetitle [duplicate]

I know this questions has been asked a lot, but after working on it for 6 hours straight I can not find a good solutions anywhere. My site has a Custom Post Type and taxonomy. My taxonomy are for ...
0
votes
0answers
34 views

Multiple Sub Domain Names - One WP Install (non-Multisite) - Default Each Sub Domain name to AUTHOR Archive

Use case is somewhat simple - here goes: Unlimited people share a single wordpress install - not multi-user Each person blogs and puts their posts in a their own unique author archive Each person's ...
0
votes
1answer
45 views

add_rewrite_rule with bottom priority doesn't handle the Wordpress pages

I have a php file named test.php that outputs the page querystring parameter. I want to use add_rewrite_rule to serve my php file, while the WordPress pages which exist already or will be created ...
0
votes
2answers
16 views

Adding Rewrite URL for Base + Children Separately

I have a main page and beyond that it has children. I successfully rewrite the children like so: add_rewrite_rule('my-url/?([^/]*)', 'index.php?my-var=$matches[1]', 'top'); This works great. But ...
1
vote
1answer
33 views

Pages should have priority when using add_rewrite_rule

I'm using the following code to have dynamic pages function custom_rewrite_basic() { add_rewrite_rule('^prefix-(.*)', 'foo/bar/index.php?page=$matces[1]', 'top'); } add_action('init', ...
1
vote
1answer
32 views

Help with rewrite rules for two post types

I'm trying to setup two rewrite rules for two post types. Basically, the structure I want is this: site.com/app/course/xxxx/ => adds query_var course site.com/app/course/xxxx/theme/xxxx/ => adss ...
0
votes
1answer
37 views

Multiple query vars sorting combination and url rewrite

I have a custom search page for a custom post type ('program'). There are 4 parameters that can be set up for this search: 'word_search', 'archived', 'category' and 'operating_system'. We can search ...
0
votes
0answers
31 views

Modify custom taxonomy permalink to allow 2 additional parameters?

I have a custom post and taxonomy set up. The only section I have in my website are taxonomy archives. The archive page lists the posts from the current taxonomy term. Each post is viewed in a modal, ...
0
votes
0answers
31 views

post_type_link and add_rewrite_rule

I created 3 custom-post-types: 'Category', 'Main-Thing' and 'Part'. Via Plugin I connect them, while 'Main-Thing' has a 'Category' and a 'Part' belongs to a 'Main-Thing'. I do not use any taxamonies ...
1
vote
1answer
33 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 ...
0
votes
1answer
16 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
27 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
72 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/]+)'); ...
0
votes
0answers
47 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
66 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
0answers
27 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
46 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
58 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
29 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
66 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
21 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
82 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
17 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
19 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
55 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
31 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
52 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
52 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
79 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
38 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
100 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
1answer
39 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
0answers
61 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
2answers
50 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
44 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
193 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
226 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
77 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
36 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
122 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
95 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
33 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: ...