Skip to main content

Questions tagged [url-rewriting]

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

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

How to make such a structure for cpt?

How to make such a structure for cpt? '/slug/%category%/%category2%/%postname%/' for post '/slug/%category1%/%category2%/' for taxonomy There will be a maximum of 2 levels of categories. If a post has ...
0 votes
2 answers
19 views

How to customize the url structure?

The problem is complex. When ACF and YAST SEO are activated, and custom taxonomy does not have a slug, the code is below. However, regular pages display a 404 error. I tested it on pure WordPress. ACF ...
0 votes
1 answer
9 views

Custom taxonomy still using query URL after fixing error

I made a mistake when creating a new custom taxonomy and custom post type. Here's the line in the custom taxonomy with the error... register_taxonomy('resource-category', ['qp_resource'], $args); The ...
juusui's user avatar
  • 1
0 votes
1 answer
12 views

Trying to Find the PHP File/Function that Handles a Specific Form Action URL

I am using a specific plugin that enables basic e-commerce functionality, and am attempting to extend the plugin functionality to include payment processing on the checkout page. The plugin itself has ...
Druid's user avatar
  • 1
0 votes
0 answers
15 views

Display A Post At A URL without Redirecting

I want to have a single post show up for multiple URLs. The post would be at "category/post-name/" and I want all URLs like "category/post-name/asdfa" to show the post, but keep ...
Sarah's user avatar
  • 1
1 vote
0 answers
11 views

How to Dynamically Change the author_base URL Slug by Language in WordPress?

I am working on a multilingual WordPress site using WPML and I am trying to adjust the author_base URL slug based on the user's language. My goal is to have different slugs for each supported language ...
Robin Martijn's user avatar
0 votes
1 answer
28 views

Redirect OLD/Path to NEWURL/Path

I am using wordpress with woocommerce and I just got a new domain and I have already migrated the old website to the new domain. My issue is am trying to redirect any one who visited any content on ...
Najm Aldekhel's user avatar
0 votes
0 answers
16 views

Unable to register rewrite rule using add_rewrite_rule

I am trying to add a rewrite rule to my plugin but somehow I can not get it to work in any way I find online. Right now I simplified it (to start debugging and moving it to the correct place later) by ...
Sander Hansen's user avatar
0 votes
2 answers
26 views

Is there a way to create a single rewrite rule to handle multiple variables depending on what is present?

I have the following rewrite rule to handle when all arguments are present: add_action('init', 'ebd_custom_rewrite_rules'); function ebd_custom_rewrite_rules() { add_rewrite_rule('^shop-region/(.*)...
Tommizzy's user avatar
1 vote
1 answer
33 views

How to add random prefix (based on related page slug) to custom post type?

I want to create some specific url structure for my website. My Pages will be Inner Home pages that will combine articles and reviews. Articles and reviews are 2 separate custom post types. I would ...
Oleksiy Goldayev's user avatar
1 vote
0 answers
26 views

WordPress pagination error when using ACF CPT rewrite slug & Polylang CPT slug translation

I use WordPress with Polylang PRO and ACF PRO plugins. Using ACF PRO I've created CPT with post_type 'aktualnosc', with rewrite slug 'aktualnosci' (same slug as page name (with posts list)). I also ...
NetPax's user avatar
  • 11
0 votes
0 answers
22 views

How to use Rewrite Tag Parameters in URL-rewritten Page's Titles (META & H1)?

I'm developing a plugin which creates a page and inserts shortcodes as content upon plugin activation. My goal is to have dynamic page URLs such as the following with data/content pulled from custom ...
slanginbits's user avatar
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
24 views

Wordpress: How to change name of ADD-ON domain's folder and also change/rename all references to it

Interserver.net hosting allows install of unlimited sites in one user account. I have set up an "add-on" domain, which is a fairly common structure but different than using WP Multi-site. ...
PP Comm's user avatar
1 vote
2 answers
47 views

Rewrite taxonomy permalink appended to CPT archive url

I need the following url structures for my Custom Posttype and Custom Taxonomy. Can anyone please help in achieving them? Spent a lot of time but failed. Ton of thanks in advance. Post URL: https://...
TechieBoy's user avatar
0 votes
1 answer
142 views

pretty url for query parametr

I want this link: site.com/c/web/theme/?filter_cms=wp Convert to: site.com/c/web/theme/wp/ I found this code and edited it a bit: add_action('init', function () { add_rewrite_rule('^c/web/theme/([...
Monoor's user avatar
  • 13
0 votes
2 answers
44 views

How to work with URLs where sometimes a post or a subcategory is in the same part of the URL structure

I have a site which has pages that show products (these aren't sold on the site, though, it's just informational). Some categories have subcategories, so the URI for a subcategory archive page looks ...
JoLoCo's user avatar
  • 111
0 votes
1 answer
24 views

Is it possible to use the same slug structure for a taxonomy and for some pages?

I have a taxonomy project_category, and I want the URLs to appear as: https://www.example.com/{$term_slug}-web-design/ I can achieve this with rewrite rules, but the problem I'm running in to is that ...
JacobTheDev's user avatar
  • 1,231
0 votes
1 answer
115 views

Is there a way to add a ACF/metadata field data to a custom post type permalink?

I am confused around how the add_rewrite_rule function works, especially with custom post types. I have a custom post type books and for each post, I have a ACF field that is called ISBN. Right now, ...
zeropsi's user avatar
  • 101
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
0 answers
20 views

Remove slug of multiple custom post types with and without hierarchical

I have two custom post types called toplijst and product. I am trying to achieve the following permalink structure: Toplijst: website.com/toplijst/parent-toplijst/ website.com/toplijst/parent-toplijst/...
sem roijackers's user avatar
0 votes
1 answer
42 views

How to keep rewrite_rule without flushing each time?

I have some custom products that need to be loaded into a specific url structure, the code is the following: foreach ($products as $prod) { $prod_obj = wc_get_product($prod->ID); $categories ...
sfarzoso's user avatar
0 votes
1 answer
152 views

Custom post type slug localization

I need to have 2 languages in a website (EN and LT). I have a custom post type 'services'. I need to have the links like this: English version of the service: '/en/services/some-service' Lithuanian (...
LinasK's user avatar
  • 1
0 votes
1 answer
52 views

Wordpress fallback rewrite

we have a situation where, for the same permalink, there could be both a page and a custom post, for example "car". https://www.example.com/aaa/bbb/carPostID Normally at that address there ...
Diego Betto's user avatar
0 votes
0 answers
16 views

Custom templates based custom url structure in wordpress

I'm working on a website that includes a section for Barbers, and I want to achieve the following URL structure: Barbers {domain.com/barbers This page will have 2 section, 1 section will list Barber ...
Tarun's user avatar
  • 1
0 votes
0 answers
29 views

get_query_var return false

I created a custom endpoint with add_rewrite_endpoint function wp_en_endpoint(){ add_rewrite_endpoint('en', EP_ALL); } add_action('init', 'wp_en_endpoint' ); But when I use get_query_var( 'en' ), ...
hamed's user avatar
  • 1
0 votes
0 answers
33 views

Custom post permalinks for specific categories

I have specific categories posts where i want to remove category name from URL. My current post link is: https://example.com/my_cat_name/post_name/ I want: https://example.com/post_name/ But only for ...
DevLoper's user avatar
0 votes
1 answer
53 views

How to make 2 (or more) custom post type post pages sit under the same slug?

I've created 2 custom post types like so: register_post_type( 'resources', theme_build_post_args( // $slug, $singular, $plural 'resources', 'Resource', 'Resources', ...
Freddy's user avatar
  • 147
0 votes
0 answers
68 views

Is there a way to use rewrite rules in Wordpress to correctly render a page or post?

I made a Wordpress plugin that was able to rewrite URLs so that users could add a vanity segment at the end of the URL so that every page had personalized information via an external API call with the ...
Zach Evans's user avatar
0 votes
0 answers
26 views

Best way to approach creating a sitemap with unique URLS (No Permalink Changes)

I currently have been struggling mightily with a conundrum, I currently have a theme that is using day and name permalink settings so changing those settings are not possible, I'm attempting to make a ...
cluelessdeveloper's user avatar
0 votes
0 answers
24 views

URL rewriting problem

He guys, I would like to rewrite URLs like the following one: https://my.domain/blog/2023/09/18/newsname to the following https://my.domain/newsname So, category (and maybe even subcategory) and date ...
mnahrgang's user avatar
0 votes
0 answers
27 views

Pretty URLs for dynamically created product and pagination pages

I want to make a simple WordPress plugin that dynamically generates a paginated listing of elements of an array and product pages for each element. It examines if the current URL contains the query ...
pete8345's user avatar
0 votes
0 answers
29 views

Preserve the url for subpage

I have a units page abc.com/units When I visit abc.com/units/toronto this shows a 404 page. I want to preserve the url /units/* and basically just redirect to units page while maintaining the url So,...
grungebobber's user avatar
0 votes
0 answers
29 views

Nesting add_rewrite_rule() with custom page and subcategories

The url structure looking for is : blog/category/subcategory/ blog/category/post/ blog/category/subcategory/post/ My rewrite rules : add_rewrite_rule( 'blog/([^/]+)/([^/]+)/?$', 'index.php?...
karolx's user avatar
  • 1
0 votes
0 answers
55 views

htaccess RewriteEngine On - Forbidden You don't have permission to access this resource

i made a staging site on subdomain on var/www/stagin but when I want to access it I get; Forbidden You don't have permission to access this resource. in htaccess I have RewriteEngine On enabled, when ...
PC Welcome's user avatar
0 votes
0 answers
26 views

CPT Rewrite Slug to Another CPT Slug/Key (as CPT-A/CPT-B Format)

I registered multiple custom post types with following pattern: CPT-A: 'has_archive'=> 'cpt-a' and 'rewrite'=> array('slug' => 'cpt-a', 'with_front'=> true) CPT-B: 'has_archive'=> 'cpt-...
Aqsa J.'s user avatar
  • 281
0 votes
1 answer
49 views

openlitespeed rewrite rules conversion from apache

# BEGIN Wordpress <IfModule mod_rewrite.c> RewriteEngine on # behind proxy RewriteCond %{HTTP:X-FORWARDED-PROTO} ^http$ RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L] # plain RewriteCond %{...
WsArea's user avatar
  • 1
1 vote
0 answers
11 views

WordPress add_rewrite_rule not working with page_on_front

I am using the following code to rewrite "example.com?my_var=test" to "example.com/my_var/test": function my_query_vars($vars) { $vars[] = 'my_var'; return $vars; } ...
Jan K's user avatar
  • 11
-1 votes
1 answer
500 views

Allow question marks (?) in WordPress permalinks

I have migrated an older site to WordPress and need to keep all legacy URLs. I am using a plugin called Custom Permalinks for that purpose, which works well, except for one thing: it strips all "...
Dave's user avatar
  • 119
0 votes
2 answers
39 views

rewrite for subpage seems to loose parameter

I have defined a rewrite rule for a subpage 'vehiculo' (which is a template-page in my theme folder), and subpage of 'vehiculos', because I want a pretty URL and the code is handled in the template ...
Canelo Digital's user avatar
0 votes
0 answers
14 views

WordPress Custom rewrite does not work with seo url

I try to generate 3 custom rewrite rule, it does not really work very well. Here is my plugin class file. <?php class QuestionAndAnswers { public $isUserLoggedIn; public function ...
Fatih Toprak's user avatar
0 votes
1 answer
40 views

How to make a Custom Post Type entry to have different parent pages

I have a Custom Post Type "press-releases" I want to be able to setup different parent pages for each entry from this CPT. Example, I want to have something like: website.com/parent-page/one-...
krj10's user avatar
  • 3
0 votes
1 answer
122 views

Allow requests to resources outside the wordpress folder

I have wordpress website https://example.com. /wordpress is never part of the url. It runs on a dedicated server that runs Plesk Onyx. The file structure is | - httpdocs | - wordpress | - ....
Sam Dean's user avatar
  • 101
0 votes
1 answer
158 views

How to set product category base the same as shop base in WooCommerce?

I'm using WooCommerce on a WordPress. I would like my products and product categories to have the same url base. E.g. www.example.com/shop/product-category www.example.com/shop/sample-product Using ...
Paweł's user avatar
  • 1
0 votes
1 answer
14 views

Blog URL Structure - Multiple Taxonomies

Does anyone know how, if it's possible, to include a base slug, two taxonomies and the blog title are the URL? All posts would have either one or two categories. e.g. /blog/{category-one}/{category-...
Sjwdavies's user avatar
  • 111
0 votes
1 answer
187 views

Add post id to url instead of WordPress default -2 suffix

I have a site where Posts in a Custom Post Type will have the same title. Per default WordPress will add a number after the url to handle this but I would like instead to always include the post id ...
Peter Isaksson's user avatar
0 votes
1 answer
128 views

Multisite: Redirect a deleted site - Best practice?

I need to clean up the web server and delete a few deprecated child sites under my multisite install. What is the best practice for setting up a 301 redirect and deleting the old site?
IUWPDEV'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
-1 votes
1 answer
23 views

How to make my custom permalink pull up the correct post

I'm tryin to make short urls. Using base_convert, I can change site.com/10 to site.com/a I'm currently using this... function shortest_permalink_make_url( $url, $post, $leavename=false ) { if ( $...
Scot Nery's user avatar
  • 101
0 votes
2 answers
60 views

Wordpress picks a wrong template if ?cat= is used as URL parameter

I have a website with the following article structure. This works and uses archive.php template like it's supposed to website.com/category/articles/arrester/?tag=online-lectures This also works and ...
Natalia's user avatar
  • 131

1
2 3 4 5
41