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
0answers
11 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
12 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
14 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
54 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
14 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
69 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']; ...
0
votes
1answer
27 views

How to use an ACF taxonomy relationship field as part of the URL structure for a custom post type?

I am working on a simple custom post type with several custom taxonomies. Using ACF I have created fields where the user can select a single value for each of the custom taxonomies. Here is my ...
3
votes
1answer
61 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 ...
0
votes
1answer
20 views

Need help with custom rewrite rule

I have a CPT called presskit, and I need to add a custom query var named welcome_box. I have this code right now: function my_new_url_querystring(){ add_rewrite_tag( '%welcome_box%','([^&]+)' ...
0
votes
0answers
23 views

Stop WordPress from redirecting ?p= in custom rewrite rule to slug of page

I've written a custom rewrite rule, which should rewrite a specific case of a taxonomy url to serve a page. The rule is as follows: add_rewrite_tag('%tax_slug%', '([^&]+)'); ...
2
votes
1answer
24 views

Single Redirection Rule for Pages and Archive links

I am trying to find pretty URL solution for url parameters. Consider this url set http://example.com?token=foo http://example.com/pagename?token=foo http://example.com/parent/childpage?token=foo ...
0
votes
0answers
16 views

Rewrite URL of a page which is child of a Custom Post Type

With the plugin Types I've created a hierarchical custom post type "journeys", and then I set that normal "pages" are child of "journeys". I've created a "journeys" post called "My First Journey". ...
0
votes
0answers
7 views

WordPress Rewrite/Query Var .. ignore a word?

I have created an 'event listing' area on my WP website, it uses rewriting and a query var to dynamically load the event 'slug' as a variable so that I can add pages on the fly. However it has broken ...
0
votes
2answers
31 views

add_rewrite_rule isnt working, not getting added to rules array, why?

I'm trying to add a new rewrite rule but it doesn't seem to be getting added to the array and it certainly isn't working. I'm trying to get this URL, dult.dev/lists/games/destiny, to take me from a ...
0
votes
1answer
31 views

configuration of .htaccess for add_rewrite_rule to make sense

I am trying this code from codex wordpress site function custom_rewrite_basic() { add_rewrite_rule('^leaf/([0-9]+)/?', 'index.php?page_id=$matches[1]', 'top'); } add_action('init', ...
0
votes
0answers
29 views

Widgets: Ajax Filtering and Add rewrite rules

I have built an Ajax filtering plugin for my widgets that works by adding url params through jQuery (when a link is clicked) and having pre_get_posts $_GET these values. These values then setup the ...
0
votes
0answers
30 views

add_rewrite_rule not working on WordPress site

For my WordPress site I am trying to make two URLs display the same content, without redirecting to the other page. So, for example I want to make: ".../books/ilium" display the same content as ...
0
votes
0answers
20 views

using two different urls for same post

I want to use two different permalinks for same post for some reasons the permalink structure i need are http://www.example.com/category-name/post-name http://www.example.com/post-name please help ...
0
votes
0answers
21 views

add_rewrite_rule working for posts but not for pagination

I have used add_rewrite_rule to change my urls please check the code below. add_rewrite_rule( '(.+?)/([^/]+)/?$', 'index.php?category_name=$matches[1]&name=$matches[2]&is_play=1', ...
0
votes
0answers
19 views

I am trying to add a mode rewerite rule that seems to fail

I am trying to redirect everything from /app/.... to a certain page Will use that later for angular js. This is what i came up with : add_rewrite_rule('/app/.*', 'index.php?page_id=11', 'top'); ...
0
votes
0answers
28 views

WordPress render's 404 for known rewrite rule

I have defined rewrite rule for my hieratical custom post type. remove_filter('template_redirect', 'redirect_canonical'); function add_artists_query_vars($aVars) { $aVars[] = "work_index"; ...
0
votes
0answers
20 views

Intermittent Rewrite Problems

I have a few custom rewrites on a site I have developed. I'm having a couple of issues: The rewrites don't work properly without using "flush_rewrite_rules(true)" directly following their setup. It ...
0
votes
2answers
112 views

My add_rewrite_rule is returning a 404

I'm using Nginx and a custom add_rewrite_rule that looks like this: function add_pony() { //this should allow me to POST to domain.com/pony add_rewrite_rule('^pony$', 'index.php?pony=true', ...
0
votes
0answers
16 views

WP Rewrite - some rewrite rules are ignored and instead a redirect is served

I am trying to allow any URI that's prefixed with pf/ to show a page without redirection. I do this by filtering rewrite_rules_array and simply duplicating the rules with a pf/ prefix public function ...
1
vote
1answer
51 views

How to building pretty URLs to reflect category hierarchy?

At the moment, this is how I access brands (custom post type) on my page: http://example.com/<base>/<brand> I would like to access brands like this: ...
0
votes
0answers
27 views

Wordpress add_rewrite_rule with priority

I'm working on a Wordpress website which shows companies in a city. The URL's are like www.address.com/new-york/. I've created a rewrite rule for this and it works but now i'm not able to visit any ...
0
votes
1answer
59 views

How to change the displayed URL?

I'd like URLs like this: http://example.com/root/branch/twig/ be rewritten and displayed to a URL like the one below: http://example.com/root/twig/ At the moment, the two URLs point to the same ...
0
votes
0answers
85 views

Using add_rewrite_rule() to redirect to Front Page

I'm using a static page for my Front page. It is a custom template. On my custom template I am using WP_Query() to show a list of posts. I also have a custom taxonomy called "Types" that I use on my ...
0
votes
0answers
20 views

Custom rewrite rule returns post instead of (start)page

I need a custom rewrite rule so that /a/b/c/d/123 points to the startpage because my own plugin on the startpage needs those parameters from the URL. / I was able to accomplish most of ...
0
votes
0answers
44 views

Trying to add $_POST Array to update_post_meta doesn't populate

This is the code that is sending the info: $postdata = array( 'show_id' => '11', 'show_start' => '2015-03-17 11:00am', 'line_items' => array( '1' => array( ...
0
votes
1answer
59 views

redirect old post type url to new structure url

i have one cpt Anime and it has post_type taxonomy with term anime and animation anime(cpt): (site domain)/anime/post title | |-(tax)Anime |-(tax)Animation And my url structure are ...
0
votes
1answer
52 views

Using category slug in add_rewrite rule

I'm using this function ro rewrite URLs: function archive_rewrite_rules(){ add_rewrite_rule( 'inspiracao/([^/]*)/([0-9]{4})/?$', ...
0
votes
1answer
29 views

Do rewrites added with add_rewrite_rule() persist after plugin deletion?

I am developing a Wordpress plugin and need to ad a rewrite url using add_rewrite_rule(). That does work. But what happens when my plugin is deleted? Does Wordpress cleanup the htaccess or do I need ...
0
votes
0answers
24 views

How to prefix all rewrite rules in wordpress?

I want to prefix all permalinks in wordpress, and get this value from query_args. For example http://wp.dev/sample-page transform in http://wp.dev/en/sample-page. I want for all permalink, for page ...
0
votes
0answers
64 views

RewriteRule directive not working without [P] flag

I need to rewrite some URL's, but I ran into strange problem. For some reason RewriteRule directive only works if I use proxy flag, for example: RewriteRule ^foo$ /www_dev/test/page2-2/ [P] works as ...
0
votes
0answers
48 views

Adding custom post types and add custom add_rewrite_rules

I am adding custom post types using the class created by https://github.com/jjgrainger/wp-custom-post-type-class I am then adding classes using this to add rewrites: /** * Class to init our mvc * ...
0
votes
0answers
36 views

add_rewrite Rule

I want to add a rewrite rule, the remove the "base" from a custom taxonomy link. There current structure is: http://example.com/bundesland/TERMSLUG I would like to have it like this: ...
0
votes
0answers
21 views

Remove rewrite path for custom taxonomy [duplicate]

I want to get rid of the rewrite path for a custom taxonomy. This is the way, I register it: register_taxonomy( 'bl_tax', array( 'stadt'), array( 'label' ...
0
votes
1answer
91 views

$error = 404 after caught add_rewrite_rule

I have a rewrite rule as this to caught old urls from a previous version of the site: add_rewrite_rule( '(ninos|familia|hogar|mujeres|hombres)-[a-z-]+\.php', 'old_id_redirect.php', 'top' ); The ...
0
votes
1answer
71 views

WP redirect rule doesn't work

I'm trying to redirect the page http://www.example.org/newsletter/unsubscribe.html to http://www.example.org/newsletter/unsubscribe. I have tried the following: ...
0
votes
0answers
27 views

Rewrite Rule Regex

I've added rewrite rule: add_rewrite_rule( 'slider-settings/(\w*)$', 'index.php?pagename=slider-settings&slider_id=$matches[1]', 'top' ); This url ...
1
vote
1answer
1k views

add_rewrite_rule() not working

I need to pass a property reference the last part of a URL to search the database for an entry, eg, http://example.com/cottage-details/G638/ I need to pass the G638 into an array for my ...
0
votes
0answers
51 views

Custom rewrite rules without a sub folder path to identify clash with pages

I need to be able to have routes to links that are both pages and products from the main wordpress root directory, without anything to distinguish between what a product (which is a template_redirect) ...
0
votes
1answer
82 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
72 views

Custom Post Type with modified permalink structure results in 404

I've defined a custom post type, 'Review', that I'd like to utilize with a custom permalink: /reviews/year/postname. The below code correctly creates the CPT and the custom permalink appears correctly ...
1
vote
1answer
31 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
1answer
71 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 ...
0
votes
0answers
52 views

Custom post type url removal for child posts

Hello so my issues is that i cannot figure out how to remove the post type name from the permalink of child post. Already went though most of the solutions on the web but not none helped. Basically ...
0
votes
0answers
55 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 ...