Questions tagged [url-rewriting]

Refers to the process whereby an URL is manipulated to create what in WordPress is called a "pretty permalink"

0
votes
0answers
13 views

How does one make a URL return dynamic JSON with custom Content Type?

Some background first, I'm trying to follow the directions here: https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html#//apple_ref/doc/uid/...
0
votes
0answers
15 views

Create subpages from subpage with fake pages

I want to automatically create pages from custom fields. I found this tutorial, but I don't use my own post-type, so I don't know how to customize it for my case. I want to do the following: I save ...
1
vote
1answer
14 views

Add language prefix to permalinks

I have a wordpress website that has multiple translations, and i was trying to get the website to determine the language to load from the URL e.g. if its https://website.com/sp/about-us, load contents ...
0
votes
1answer
33 views

Add term slug in URL of custom post type details page

I have created a custom post type called "movies" and I have added custom taxonomy "Available for " and it contains two terms Rent sales. Current movie post details page URL movies/avengers-endgame/...
0
votes
0answers
13 views

Include CTP slug to custom taxonmy URLs

I am trying to rewrite a custom taxonomy url to include the CTP slug to which the taxonomy is assigned to. For example: https://www.example.com/motors/taxonomy-slug/ Where motors is the CPT slug ...
0
votes
0answers
11 views

Taxonomy Query String convert to Url

In my site, I use woocommerce and a plugin filter to combine wordpress category with custom taxonomies. If I in my sidebar filter I select one category and one custom taxonomy i have this link ...
0
votes
0answers
25 views

Problem building an url with argument

I have tried to build an url using a parameter, and it depends on the element the user clicks. I have used the method add_query_arg( 'id', $id, 'http://example.com' ), and the href value of the ...
0
votes
0answers
22 views

Numericals in my URL

My URL looks something like this: https://agencypedia.com/?llocs=jaipur&lcats%5B%5D=169&post_type=listing This is because of the latitude longitude thing in the theme. How do I fix the URL?
0
votes
1answer
20 views

Custom Post Type not using correct page template

I've been having trouble lately in trying to figure out why this custom post type is not using the correct template file. The custom post type is called 'job' and it has a rewrite on it for the slug ...
0
votes
0answers
15 views

Rewrite tag and url with 1 variable in array

i explain what i try to do. First i have WP 5.2 and Php 7.2. i have a form which send a variable array like myVar[] to another page template. the url is http://mysite/mypage.html?myVar[]=item1&...
0
votes
0answers
29 views

Custom Taxonomy Rewrite redirects back to home page

I have a custom post type with two taxonomies set. On my Episode CPT I have a rewrite arg set to "rewrite" => array( 'slug' => 'bctv', 'with_front' => false ). Then on my Taxonomy I also have ...
0
votes
1answer
29 views

Change CPT permalink to use the category

I have a CPT called teachers and a custom taxonomy called teacher type. I'm using the code below to rewrite the url for the CPT and instead of being like: website.com/teachers/post1 it changes the ...
1
vote
1answer
43 views

Append country to 'pretty' url but serve same page

For one particular page on my site I would like to append the country to the URL. The reasons for this are purely aesthetic so the customer knows that the prices on that page are in their own currency ...
0
votes
0answers
20 views

Redirect page to homepage, keeping URL

I'm creating a site where every page is really rendered on a single page - the homepage. I'd like to make it so page URLs - like /about-us/ - redirect back to the homepage, but keep the same URL (/). ...
0
votes
3answers
31 views

Why is WordPress rewriting absolute URLs on staging site to include staging prefix when we manually point them at the live site?

Edited for clarity and to display steps we take to reproduce the issue. Question What would cause absolute URLs on our staging site to prepend the staging site's subdomain to them when saved in the ...
0
votes
1answer
21 views

CPTUI rewrite disable when no post in CPTUI has been found

I have a CPTUI with the following data: function cptui_register_my_cpts_activaties() { /** * Post Type: Activaties. */ $labels = array( "name" => __( "Activaties", "red-...
0
votes
1answer
34 views

How to rewrite product permalinks in Woocommerce to use category slugs

I know here is an information about the issue, but I didn't find full working solution. I need to use product category slugs in my product permalinks so the links are to be like example.com/laptops/...
0
votes
1answer
14 views

How to Update / Change URL when Popup Modal Loads?

I'm looking for a way to have a popup modal with a form, and whent he popup loads, the URL changes. For example, if a person is viewing web.com/about and the popup loads, then it will change the URL ...
0
votes
1answer
28 views

Add slug to default post permalinks ONLY

I've been browsing and reading and testing and can't seem to find a clean solution for my problem. A solution that doesn't affect all other post types, categories, custom taxonomies, etc. :( Is there ...
0
votes
0answers
21 views

Change custom rewrite rule when permalink is updated/changed

I have a scenario where i need to make a rewrite rule dynamic so that when permalink is changed the re-write rule should get updated as well function rewrite_rule() { global $wp_rewrite; $...
0
votes
1answer
51 views

Rewrite rules in multisite

I've been trying to set up different rewrite rules on my multisite installation, but as of now, nothing is working. Even the simple add_rewrite_rule('^welcome$', 'index.php?p=1', 'top'); isn't ...
0
votes
0answers
28 views

Add a url parameter to the current post and read it in a shortcode

I am trying to add a parameter to the currently visited url but it doesn't work. I've tried query_vars, pre_get_posts, post, post_link, page_link,post_type_link.... None of this work... How can I ...
-1
votes
1answer
26 views

Wordpress Post url encoding problem

I have a wordpress site. In a post I use a clickable another post link like "https://domain.ext/another-post-link", but I do not want to the display the link in the browser address bar and in replace ...
0
votes
0answers
17 views

How to translate wordpress filter slugs

I'm trying to translate filter slugs based on the current language. I can successfully translate taxonomy slugs using wpml_translate_single_string For example: localhost/products/oil_type/ gets ...
0
votes
0answers
8 views

URL rewrite cannot launch website

Can’t get to dashboard All I did was change the Wordpress URL. Website is messed up after trying to switch the posts page to home page
1
vote
1answer
33 views

Remove custom post type slug not working for child pages

I'd like my custom post type, products, to not use a slug, eg: domain.com/product-name. The code below sorts that out nicely, however it fails to work with child pages, eg: domain.com/product-name/...
2
votes
1answer
33 views

How to get “extended” path info from URL in a plugin

Working on a plugin that creates short codes to embed into a page. I have permalinks set to "Post name", so http://example.com/post-name/ I want to be able to pass additional information in the URL ...
0
votes
1answer
141 views

Integer based rewrite isn't recognized for value of 1

I have a simple rewrite to pass a variable: // Add custom URL parameters function add_custom_query_var( $vars ){ $vars[] = "item_id"; return $vars; } add_filter( 'query_vars', '...
0
votes
1answer
34 views

add_rewrite_rule wordpress ignoring url pattern, wp rewrite not working

I want to want to make url friendly urls for a custom function I am using in my website. I have added a custom template on my theme dir. The url rewrite function that looks like this: function ...
3
votes
1answer
54 views

Custom post type permalink changing itself every other change

I have created a parent > child > grandchild structure. (Courses > Series > Episodes). I have created the below code which updates the urls for each of the custom post types so that I can have the ...
1
vote
0answers
22 views

Wordpress custom post type permalink rewrite shows page not found

I need to have 3 custom post types in my wordpress site, each one being a parent of another. Courses > Series > Episodes I have fully created a functions file that registers the custom post types ...
0
votes
1answer
14 views

How to fix 404 on post after prepending Custom Post Type url with Custom Taxonomy Term slug

I'm setting up "special" url structure for posts etc Result i want to get is: sitename.com/club/justcavali club is term from taxonomy (club_type) and justcavali is post type (booking_type) after i ...
0
votes
0answers
12 views

How to Select post parent for CPT from another post type?

I'm developing a Sports website, covering cricket football, etc. The goal is: .pk /cricket (Landing page) .pk /cricket/ipl (IPL Landing Page) .pk /cricket/ipl/year (IPL Landing Page by ...
0
votes
0answers
42 views

WordPress changes URL on admin page

We have 2 projects. https://host/ - first (on Node.js), https://host/modules/ - second (on WP). Before that nginx stays as reverse-proxy. When I'm on page 'modules', everything is good, but when I go ...
2
votes
2answers
57 views

Add Rewrite Rule to point to a file on the server

I'm trying to add a rewrite rule that will point to a file inside a plugin. This can be added in the plugin, theme or .htaccess file. My current code from inside the theme's function.php looks like: ...
0
votes
0answers
20 views

Passing URL parameters to WordPress buttons

I'm beginner with programming and web development. I have a WordPress website (http://www.example.com). My post link is http://www.example.com/mypost/, so when I click on a button (assuming demo 1 ...
0
votes
0answers
16 views

Remove Page from title with custom query rewrite

I have a custom query rewrite to accept a numerical parameter (mywp.com/foo/bar/1746). My issue is that the title of the page displays as "MyWP - Page 1746 - Page". Is it possible to change the title ...
0
votes
0answers
18 views

How wordpress core include search.php with $_GET['s']?

I want to include custom_search.php when there is $_GET['my_s']. As you know, if we type on a search field, WordPress core includes search.php file because WP Core get $_GET['s'] as query var. How ...
0
votes
1answer
46 views

Rewriting url for multiple Taxonomies and Custom Post Type

I have 2 taxonomies ( genre and artist ) and Custom Post Type ( Lyric ) the url structure i want to get is CPT: /lyrics/ - archive page for CPT Artist: /lyrics/artist/ & /lyrics/artist/song-...
0
votes
0answers
29 views

How to add a custom permalink structure tag?

I'm trying to add a new %taxonomy-name% tag to Custom Structure in /wp-admin/options-permalink.php. I have registered a custom taxonomy called company, and I noticed that I can use a tag named as ...
2
votes
4answers
170 views

Custom rewrite rule sends 404 header on multisite

I have a custom rewrite rule which rewrites /wp-content/themes/my-theme/manifest.json to /index.php?manifest=true. This generates some JSON code for progressive web app functionality, and generally ...
3
votes
1answer
48 views

Taxonomy rewrite question

I have custom post types for dining, lodging, and activities. Each of those custom post types uses a custom taxonomy called region. If, for example, I have a region called "downtown", I would like to ...
1
vote
0answers
21 views

How to show the root webpage on all subpaths

I want to show the same page on all the subpaths on my web site /events/ /events/firstOne /events/secondOne/edit /events/whatever/blahblahbla/helloworld All that urls must load the same root page. ...
0
votes
1answer
28 views

Unable to access the query variables in the template

I added a custom endpoint 'product' in the pages. add_action( 'init', 'add_endpoints'); function add_endpoints() { add_rewrite( 'product', EP_PAGES ); } I added a shortcode called `'dashboard' ...
2
votes
1answer
55 views

Having trouble with using add_rewrite_rule and pagination

We have a section on the site, such as: www.example.com/for-sale/category-name/ for-sale is a WP page, however category-name is dynamic and is what I wrote the below rewrite rule for. ...
0
votes
0answers
67 views

Custom Post Type parent/child relationship rewrite rules for permalinks

I have been working on this for quite awhile but I'm stuck at rewriting the permalinks for both the parent and the child. So I created two custom post types: magazines and magazine-pages both MUST be ...
0
votes
0answers
23 views

Change url parameter's name with rewrite

¡Hello! I need some help... I get this URL: https://mysite/entrevista-sesion/?Name=pedro And I need to change the parameter's name to: https://mysite/entrevista-sesion/?n=pedro I'm trying to ...
0
votes
1answer
57 views

Custom rewrite after the default term link URL

I have a taxonomy car and a couple terms like kia, honda, and toyota. Using the function get_term_link(), I can get a term archive link like this: site.com/car/honda/ I am trying to use custom ...
0
votes
0answers
17 views

Custom taxonomy in product url

I have a custom taxonomy for products, which i need to set them in product URLs as well. It will be dynamic. so for example This is what i want. https://example.com/taxonomy_value/product_name Right ...
0
votes
1answer
36 views

URL rewrite rule

I have taxonomy product_brand and product_cat I have a link: /product_brand/brand_name/?attributes[product_cat]=product_cat_id How to convert to pretty url? /product_brand/brand_name/...