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
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 ...
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
20 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/]+)'); ...
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
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
46 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
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
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
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
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 ...
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 ...
1
vote
1answer
70 views

Custom Endpoint Gives 404 Header

I'm trying to write a general endpoint that loads a template. It works as expected with the small exception that the returned header is 404 - Page not Found. Am I missing something in my rewrites? ...
0
votes
0answers
57 views

Blog List Page 404 With Custom Post Type Rewriting to Blog Parent

There will be a lot of code blocks below, but here's the short version: On a site, I have a Resources custom post type, with a Resource Types taxonomy. The URL for a Resource Type post archive is: ...
0
votes
0answers
56 views

Pagination appearing twice in URL after rewrite

For my site, I have a custom post type video set to appear at at the URL http://site.url/videos. It is paginated so that there are 24 videos per archive page. However, I am not using the single.php to ...
0
votes
0answers
27 views

Rewrite rules are correct but ignored

I am trying to get the following URL to point to a particular WordPress page. URL/courses/computer-course/units/ needs to redirect to URL/units/ with coursename='computer-course' and page_id='228'. ...
0
votes
0answers
27 views

Passing values in SEO friendly way

Here is the link I have right now : domain.com/my-basic-page/?state=colorado&city=austin Here my-basic-page will be always same. I have written some stuffs to do with those state & city ...
0
votes
0answers
28 views

Rewrite / Template Include Filter, assumes front-page?

I'm pulling in data from a 3rd party API for a project I am working on. I've filtered template_include to pull a template query var, which I pass through various add_rewrite_rules. My problem is ...
0
votes
2answers
27 views

rewrite_rule - working fine but broken for pagination

I'm having an issue with me rewrite rule works fine here: example.com/resources/ example.com/resources/articles/ but when i use pagination to the next page i get a 404 here: ...
0
votes
0answers
134 views

Add custom parameter to permalinks

I have a WordPress page that I would like to use SEO friendly query parameters with. Let's say this wordpress page is accessible by going to http://www.example.com/test and its short URL is ...
0
votes
0answers
17 views

Can I use the same permalink base for Categories and Posts?

I am migrating our site from another CMS and the way the permalinks were setup with the prevous CMS are like this: posts: /news/%year%/%monthnum%/%day%/%postname%/ categories: ...
3
votes
1answer
189 views

Sync posts from one WordPress site to another

I want to achieve the following - I have 2 WordPress sites hosted on different servers. Let's call A as sender site and B as receiver site. Whenever I add/update/delete any post in A, it should be ...
1
vote
0answers
18 views

Redirect on Empty Query Var [duplicate]

I have a plugin with two rewrite rules: public static function cp_libdatabases_add_rewrites(){ $options = get_option( 'libdatabases_plugin_options' ); $staff_url = $options['staff_url']; ...