Skip to main content

Questions tagged [rewrite-tag]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
13 views

`query_var` values empty in theme file after `add_rewrite_rule` redirection

I am redirecting a specific url format using add_rewrite_rule after adding an additional query_var (mlang) to it. Example: http://localhost/periodicals/sri-bn is to be redirected to http://localhost/...
sariDon's user avatar
  • 265
0 votes
0 answers
61 views

Cannot use dynamic prefix for WooCommerce permalink

I need to use a dynamic permalink structure for WooCommerce products, basically, the structure I'm trying to achieve is the following: /<dynamic>/post_name. So what I did is create a rewrite tag:...
sfarzoso's user avatar
0 votes
1 answer
52 views

wordpress category rewrite rule with pagination

with the help of someone here I was able to filter two or more categories via this rewrite rule '^combine/([^/]*)/?([^/]*)/([^/]*)/?','index.php?category_name=$matches[1]+$matches[2]+$matches[3]', '...
inrob's user avatar
  • 103
0 votes
0 answers
28 views

add_rewrite_rule doesn't work when trying to add a new parameter at the end of URL

I wish to add a userq parameter at the end of a URL with the username such as john. I wish to change, example.com/user/john to, example.com/user/index.php?userq=john I tried this and this and they ...
ratib90486's user avatar
1 vote
0 answers
39 views

Rewrite URLs in a Custom Post Type with Multiple Taxonomies

I'm trying to filter the content of a custom post type, but I can only get it to read the first variable. The custom post type has 3 associated taxonomies that if I pass them through GET in the URL it ...
Carlos Polo's user avatar
0 votes
1 answer
30 views

Get wordpress installation folder

I'm writing a rewrite rule, accompanied by two additional rewrite tags, which (the tags) must apply only on a specific page. In the past, when I had to do something similar, I had done it like this: ...
Faye D.'s user avatar
  • 126
0 votes
1 answer
91 views

Custom Post Type posts, conflict with posts after add_rewrite_rule to top

I had cpt with taxonomy like this: add_action('init', 'zsz_add_posttype'); function zsz_add_posttype() { // -- Taxonomy CATEGORIES - [category-a] [category-b] [category-c] [...] ...
Patryk Chowratowicz 'Zszywacz''s user avatar
0 votes
0 answers
136 views

add_rewrite_rule() issue with parent/child/child page

I have a parent/child and another parent/child/child pages. I have 2 separate page templates for both pages and the following add_rewrite_rule() code in place: add_rewrite_rule( '^user/dashboard/([^/]*...
Kunal's user avatar
  • 101
0 votes
1 answer
196 views

how to change the title of tag page?

what is the correct function or hook to change the title of tag page ? I want to insert something at the beginning the tag title page.
Mohammad Mahdi Aghakhani's user avatar
0 votes
1 answer
64 views

Combine multiple CPT names to create valid permalinks

I have three different Custom Post Types: Company Employee Project They are connected with ACF relationship fields so as the Company can have multiple Employees and each Employee can have a project ...
Damian Doman's user avatar
0 votes
0 answers
96 views

How to build a achieve page for a custom CPT with multiple taxonomy button filter

This is an extended question from Permalink for CPT with taxonomy I am building a website that has a CPT and a few custom taxonomies. Each single CPT post is basically "a question" for ...
Atimmy's user avatar
  • 55
0 votes
1 answer
27 views

Having a problem with rewrite_rules and rewrite_tags - url not rewriting properly and query var missing

I am almost tearing my hair out trying to get to grips with the Wordpress rewrite rules and tags. From within a plugin, I've created a page called 'childpage', it is the child of another page called '...
appshine's user avatar
0 votes
0 answers
24 views

Multiple Taxonomy Items for Separate URLs

Can anybody just let me know if this is possible for the start? I have Custom Post Type "Recipes" and a Custom Taxonomy "Type", which consist of multiple items: breakfast, snack, ...
Dachony's user avatar
1 vote
1 answer
611 views

Can't get custom rewrite tag, query var, permastruct (permalink structure), and rewrite rule to work properly together

Problem specification I'm implementing a website that is meant to host podcast shownotes and transcripts, and so I want custom permalinks and shortlinks for the webpages: Permalinks of the form /...
Jivan Pal's user avatar
  • 113
1 vote
0 answers
39 views

Rewrite URLs - Custom Post Type - Post Slug, Taxonamy Slug

Am using a third-party plugin for listing schools. Custom Post Type = school Custom Post Taxonomy 1 = school_type (eg. values = Primary, Intermediate) Custom Post Taxonomy 2 = school_location (eg. ...
Vpp Man's user avatar
  • 123
2 votes
0 answers
42 views

How to restore WP 5.4 behaviour where a numeric string could added to each page URL and parsed as "page" in WP 5.5?

In WP 5.4.x, I was able to add a number to the URL for any page, post, etc. (incl. custom post types), which WP interpreted as the 'page' for a multi-page post, even if that page or post didn't ...
Marcus W's user avatar
0 votes
0 answers
141 views

Where to add add_rewrite_tag for trailing tilde?

Ive just been reading @gmazzap s reply about wordpress matching URLs with trailing tildes. and could do with some help please. As a coding newbie, I am not sure where to add his suggested code: ...
minnow's user avatar
  • 1
0 votes
0 answers
333 views

add_rewrite_tag broke permalinks that doesn't use that specific tag

I have a custom post type that I'd like to have a permalink slug based on its taxonomy. All the posts of this CPT have one, and only one, term always marked on this specific taxonomy. That's my code: ...
Feel The Noise's user avatar
0 votes
1 answer
46 views

Create new URL structure for custom post types

I have 3 custom post types: development house_type room I have used ACF to build some relationships between these custom post types so development sits at the top and can have many house_types ...
geoffs3310's user avatar
0 votes
0 answers
61 views

a way to support totally different url structure

I need to support permalink URL structure like: http://example.com/adult-course/newyork/language-course/english/standard http://example.com/adult-course/newyork/language-course/english/profi http://...
Picard's user avatar
  • 1,145
1 vote
0 answers
41 views

Custom permalink leads to index page

I have a custom post type named patch and custom permalink structure: www.site.ru/patch/%version_id% I managed to replace %version_id with actual version code with this code: add_action('init', '...
CMTV's user avatar
  • 125
1 vote
2 answers
1k views

How to add custom variable in url without redirect?

I'm trying to add a local variable to my URL. As an example I have this URL: mysite.com/my-page-name/ And I want to add 'en' variable into it and leave the page working properly: mysite.com/en/my-...
Stanislau Ladutska's user avatar
3 votes
1 answer
759 views

Multiple values in a rewrite rule, is it possible?

I'm using url rewrites for a filter i'm building. The current solution works for one selected value. So if I select one type of dish like dinner, it goes to /recipes/dinner/. But what if I want to ...
Roy's user avatar
  • 55
1 vote
1 answer
124 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 ...
Diego de Oliveira's user avatar
1 vote
1 answer
160 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 ...
Howdy_McGee's user avatar
  • 20.7k
4 votes
1 answer
5k views

permastruct for custom post type not working in one of four cases

I've created custom permalinks for various custom post types on a website. They all worked. Until recently I added another one, which I cannot get to work 8-o. The "company" struct is not working and ...
Jos's user avatar
  • 426
0 votes
0 answers
79 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, ...
aifrim's user avatar
  • 526
1 vote
3 answers
5k 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 http://...
Fernando Vera's user avatar
2 votes
1 answer
1k views

Permalinks, Rewrites, Get Variables, Oh My!

Ok, so I know it's a silly title, but it's exactly how I feel right now.. I've created some custom rewrites for WordPress and they work great, the only problem is that now I need to add pagination. ...
Austin Biggs's user avatar
0 votes
0 answers
100 views

URL Rewrite for CPT single posts

I'm struggling with Wordpress' rewrite function I have the following URL structure http://example.com/album/test-7/ 'album' is the slug for the CPT single page 'test-7' is the slug for the CPT post ...
Austin Biggs's user avatar
1 vote
1 answer
9k views

Custom query_vars and parse_request on wp-admin

I've read this post http://wordpress.org/support/topic/query-vars-in-admin and although it's quite an old question, it suits me perfectly. I'm trying to accomplish what I already posted here: ...
arnaldo2204's user avatar
0 votes
1 answer
1k views

Passing variables in the permalink structure on a custom post type

I have a structure like this for my custom post types: domain.com/member/member-name/book/book-name Basically, I have a custom post type of member, and the member-name is the post. What I want to do ...
ThePHPUnicorn's user avatar
0 votes
3 answers
1k views

Why isn't my rewrite rule working when there is no second parameter?

Here is my rewrite rule code: add_rewrite_rule('tides/([^/]+)/([^/]*)', 'index.php?page_id=4348&location=$matches[1]&month=$matches[2]', 'top'); add_rewrite_tag('%location%', '([^&]+)'); ...
Khan's user avatar
  • 113
0 votes
2 answers
2k views

WordPress Rewrite rule is not working

I am trying to create a rewrite rule for one of my custom page and here is the rewrite rule function add_my_rule() { global $wp; $wp->add_query_var('name_state'); $wp->add_query_var(...
Umesh Awasthi's user avatar
5 votes
1 answer
854 views

Regex in add_rewrite_tag not accepting OR operators?

I am trying to add a custom field to the post permalinks by using a combo of add_rewrite_tag and applying a post_link filter. What I am aiming for is something like this: http://example.com/%...
Alex's user avatar
  • 59
2 votes
1 answer
2k views

Taxonomy Url with Custom post type prefix re-write rule

I have a taxonomy called Section and a Custom post type called Developments. What i need to achieve is a permalink on the taxonomy with custom post type prefixed: e.g: custom post type: development &...
Loxzibit's user avatar
  • 153
0 votes
2 answers
991 views

Redirect taxonomy to custom template to list terms in taxonomy

I'm trying to adapt some code on calling a custom template via rewrite rule. I have a custom taxonomy called "state". I want to create an archive for the taxonomy, that lists all the terms in that ...
helgatheviking's user avatar
0 votes
1 answer
163 views

Rewrite rule help for gallery plugin

I am writing a basic gallery plugin for WordPress. In the plugin users can mark images as favorites and there is a page where users can see their favorites. I want to setup some rewrite rules for the ...
sccr410's user avatar
19 votes
1 answer
6k views

Using the Rewrite API to Construct a RESTful URL

I'm trying to generate rewrite rules for a RESTful API. I just want to see if there is a better way to make this work than having to write out every possible rewrite combination. Ok so I have 4 ...
kingkool68's user avatar
  • 1,219
0 votes
1 answer
514 views

Append custom parameter to taxonomy/term URI

I have a Custom Post Type named "Cars" and 2 Custom Taxonomies "Ferrari" and "Lamborghini". Each taxonomy has 2 Terms: "New" and "Used". These URIs work as expected: http://myhost/ferrari/new http://...
gyo's user avatar
  • 326
1 vote
0 answers
71 views

404 error using Meta for Permalink rewrite

I'm trying to rewrite my permalinks using meta data from my post. The permalink rewrite works fine but I'm getting the 404 error when I try to view the post. Could someone offer a clue as to why this ...
Zac Jokface's user avatar
0 votes
1 answer
103 views

Custom Taxonomy in Permalink from post type

I am using custom post types and custom taxonomies for that post type. This snippet currently sets the permalinks for the post type: 'rewrite' => array('slug' => 'myrewritebase'), I am ...
lars's user avatar
  • 1
3 votes
0 answers
219 views

What add_rewrite_tag()'s RegEx matches against?

I'm trying to figure out wether I can specify the position of the string to match (i.e. immediately after the domain) to reduce the chances of matching something else, but I don't even know what the ...
sergio's user avatar
  • 270
4 votes
2 answers
11k views

Rewrite Rules for Multiple (more than 2) Taxonomies

I am using woocommerce and have some 'product attributes' which are just a taxonomies. I have the following taxonomies: pa_color pa_material pa_style the pa_ stands for product attribute and it is ...
helgatheviking's user avatar
0 votes
1 answer
1k views

why is are these rewrite_tags and rules not working?

im trying to get this to work for 3 different pages it was working fine with 1 rewrite, then when i added 2 more its not working for any of them. heres the code: function add_video_rewrite () { ...
scarhand's user avatar
  • 135
0 votes
1 answer
208 views

help with rewrite_tag and rewrite_rule for custom page GET variables [duplicate]

Possible Duplicate: custom htaccess rewrite rule for page ok i made another post and i got pointed to the Rewrite API however, when i do print_r($_GET) on the page, it echos an empty array ...
scarhand's user avatar
  • 135
4 votes
1 answer
2k views

How to filter custom post type archive by meta value

I have a problem where I'm trying to build a calendar plugin for a client. I'm having trouble getting a date based archive for the custom post type I'm using. I'm not too well versed in how the ...
Emil Björklund's user avatar
2 votes
1 answer
5k views

Prettified page URL w/ query var redirects to prettified page URL w/o query var

I have a page created (page ID 235) with a page template that will need to be passed a variable. I would like to pass this variable through the URL. My first attempt was to pass this with a GET ...
Doggie52's user avatar
  • 182
2 votes
1 answer
1k views

custom permalink/shortlink with base62 encoded post ID

I want my post-links to look like /%post_id62%_%postname%/ where %post_id62% is the post ID in base62 encoding (e.g. http://example.com/y9Rlf_test/) and my shortlinks to consist of /%post_id62% only (...
user6254's user avatar
  • 125
0 votes
1 answer
3k views

How to test custom rewrite rules /permalinks?

After much research, I think I can wrap my brain around WP's rewrite system. I would like to know, though, how to properly test rewrite rules to see if the right rule/tags is being used and the right ...
Manny Fleurmond's user avatar