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
1
vote
2answers
146 views

URL Rewriting for PHP script on an image URL

I built an image randomizer so that when I open a .php file in a URL that it displays the image with readfile($randomImage);. This works locally but when I upload it to the server it gets blocked by ...
0
votes
2answers
71 views

Woocommerce different URL for every table placed in the restaurant

my company is working with different restaurants to digitize their menus so that people dont touch the menu cards in this Covid 19 pandemic, so every table in a restaurant will have a unique qr placed ...
0
votes
1answer
229 views

Pagination custom post type not working with rewrite slug

I can't find the way of making my pagination to work on my post type (this is not on an archive-posttype.php). I've rewrited my post type, but the second page isn't working if I do the rewriting (&...
1
vote
2answers
154 views

Create Dynamic SEO Friendly URL for Virtual Page

I have a Wordpress site that is built to be a job listing board, and I'm looking to create SEO friendly URLs based on data that is stored in the database. The URL structure should include the state ...
0
votes
2answers
56 views

After creating Custom post type by user delete old one

I have created a form where users update their profile. When a profile is created or updated it creates a CPT called course. The url is the permalink + /course/ + the title of the course /* CREATING ...
0
votes
0answers
28 views

How to rewrite rule and change product url to categories and product name?

Will really appreciate your help on how to rewrite products urls to be based on categories names (not category slugs). Let's say this is the structure of the categories and the product: Men (slug: men)...
1
vote
2answers
40 views

add_rewrite_rule with query variables

We have rewrite rules as: add_action( 'init', function() { add_rewrite_rule( 'app-api/v2/ecommerce/([a-z0-9-]+)[/]?$', 'index.php?p=$matches[1]&post_type=product' ); } ); for the URL - www....
0
votes
0answers
24 views

WordPress rewrite rule depend on meta values not ids

I have a custom post type and i'm using the rewrite rule to change the URL from mysite.com/collection?brand1=365&brand2=412 to mysite.com/collection/compare/365-412 But I want to depend on meta ...
0
votes
0answers
18 views

Allowing multiple URLs for same Post

For a specific post, I want to create the illusion of child-posts. The current post permalink structure is set to /%year%/%postname%/. So using this post URL as an example: https://example.test/2020/...
0
votes
1answer
14 views

How to construct a dynamic rewrite rule for child pages that passes more than one query var

I get a 404 error parent-page/any-child-page/?var1=x&var2=y&var3=z This is what I have so far: I want to have the rule cover any child page add_rewrite_rule('^project-centers/(...
0
votes
3answers
81 views

Why wordpress rewrite my custom URL?

I am new in wordpress There may a mapping question in my website I hope this SEO URL is work and get Post data: http://domain/web/d-post/M00069/TomLi If not using SEO URL(get action), it is work! http:...
0
votes
2answers
314 views

Custom Rewrite Rule Removing Query String

I'm trying (and failing) to use rewrite rules to redirect shorter/prettier URLs to the right page AND include values in the query string. WP is installed at https://example.com, and the plugin creates ...
1
vote
0answers
26 views

How Can I Change the Custom Post Type Slug to the Taxonomy Slug in the URL?

(Forgive me, I know this question has been asked extensively but I haven't found an answer that works for me) I'm working on a website for a webcomic. I have a custom post type set up called "...
1
vote
0answers
13 views

Rewrite Rule Working for all but one of the taxonomies created

I have a hierarchical taxonomy, county, which takes a parent and child taxonomy as well as a rewrite rule to include them in my permalinks. I have three of these county taxonomies, but only two of ...
0
votes
0answers
11 views

Multiple Taxonomies rewrite rules for wordpress

i would generate a permalink for multiple taxonomies for a custom post type. I have a custom post type: Location I have these taxonomies: City Location Type I would generate a pretty url while while ...
0
votes
0answers
23 views

How To Change a Search Submit URL

how should i change this url: http://127.0.0.1/infobd/new-info/?keyword=hope To this URL http://127.0.0.1/infobd/new-info/hope using .htaccess or add_rewrite_rule it's a search submit URL on WordPress ...
1
vote
1answer
399 views

Translate custom post type and taxonomy slug in URL?

I need help how to translate the custom post type and taxonomy when using multisite and multi-language. I am using subdirectory a /en /sv etc. Are using the plugin (Multisite Language Switcher), but ...
0
votes
0answers
14 views

Custom permalink structure with categories and custom post types missing top level pages/posts

Having some trouble with an unexpected result here: function features_rewrite_link($post_link, $id = 0) { $post = get_post($id); if ( is_object( $post ) && $post->post_type == '...
0
votes
0answers
16 views

How to have profile URLs like /profile/username?

I am in a problem with creating a profile page.I have created a custom template for profile.I have url slug for profile demo.mysite.com/profile/ this is working file.But If i want to make username ...
1
vote
2answers
35 views

Problem with add_rewrite_rule

Been trying to re-map the following /test-sale-yacht/comfortably-numb-262749/ /test-sale-yacht/?yacht_name_id=comfortably-numb-262749 After some testing in a regular expression tester I've put the ...
0
votes
0answers
22 views

Adding menu title to custum URL

I want to customize my url rewriting this way : urlhome/MenuTitle/PageTitle. Is there a way to do it?
1
vote
1answer
77 views

Wordpress rewrite rules don't need ^?

For example this code class My_Sitemap { public static function install() { add_filter('rewrite_rules_array', array(__CLASS__, 'rewriteRules'), 1, 1); global $wp_rewrite; ...
0
votes
1answer
125 views

Custom permalink structure for custom post types including multiple taxonomy

The goal is to have a structure like this: example.com/tax_1/tax_2/post_name This code produces the right structure but the post can't be found (404) // Register custom post types function ...
0
votes
0answers
46 views

How can I assign multiple parents to CPT?

I have created cpt called product-1, this product qualifies for 2 categories "paints" and "coatings", however I can only select 1 parent for the post. What would be the best way to ...
0
votes
0answers
25 views

Dynamic URL based on keyword

I'm trying to integrate Tradingview charts to my wordpress site. I will store stock name in my database. Suppose someone searches for AAPL, the url should have AAPL as the stock name and accordingly, ...
0
votes
0answers
20 views

one url for all pages

Recently I just stocked over something which I can not fix or solve! I like to use a single url like www.mywebsite.com or www.mywebsite.com/something for all my pages. the reason is that I have a ...
0
votes
1answer
64 views

Set parent for custom post type archive rewrite url

I have 2 custom post types Offices register_post_type('offices', [ 'labels' => [ 'name' => __( 'Offices' ), 'singular_name' => __( '...
0
votes
0answers
18 views

Translation of page slugs using code

I've translated my website using translatepres plugin. I now need to translate all the page slugs like from site.com/se/contact/ to site.com/se/kontakt/ Please provide some useful funtion or hook to ...
0
votes
0answers
36 views

How to create dynamic URLs on WordPress?

I have a site where users can download freeware software. I want to create a dynamic download page. How to prevent the https://example.com/software-name/download/ URL from returning 404. /download/ is ...
0
votes
0answers
21 views

Creating two pages out of a custom post type

I am trying to create two different URLs from a single post type with custom post types. Currently I have something like from my post type: url.com/big-jellybeans/blue big-jellybeans being the archive,...
1
vote
0answers
51 views

Use same slug base for Custom Post Type posts, and multiple taxonomy terms

I have done a lot of digging the past few days, and can come close, but not exactly what I need. I'm trying to alter a custom taxonomy/CPT permalink structure to all use the same slug base: /resources/...
0
votes
0answers
29 views

Extract info from url using add_rewrite_rule vs. parse_request

While setting up a url example.com/info/1234 for logged in users, I noticed that there are two ways to achieve the same result (extract id=1234) a) add_rewrite_rule() and add_filter('query_vars') and ...
1
vote
1answer
125 views

Put post ID on the custom post type URL

I want to get this link structure mysite.com/sa/post-slug/post_id/ on my custom post-type. This is the post_type: // ex_article Post type add_action( 'init', 'ex_article_init' ); function ...
0
votes
1answer
99 views

Permalinks on Windows IIS not working and web.config breaks site - does wordpress not support windows server now, if so how?

I have a large wordpress site that I migrated from AWS/Linux to a different host that is Windows Server 2016. I have been developing on wordpress for years but this is my first time back on Windows ...
0
votes
1answer
48 views

Rewrite rule regex help required

Hoping you can help with this... WE have a 'serivces' custom post type that allows a 'service' to have a parent 'service'. Our custom rewrite rule works for top-level services but not child services. ...
0
votes
0answers
28 views

Adding a page to custom post type hierarchy?

My custom post type has the URL Structure "/work/post-name" The default archive is disabled with "'has_archive' => false" and replaced by a WordPress Page called "/work/&...
0
votes
0answers
31 views

Redirect empty search to another page

I am using the following code to change the url of my search results page: function wpb_change_search_url() { if (is_search() && !empty($_GET['s'])) { wp_redirect(home_url("/suche/...
0
votes
0answers
14 views

../../page-name backend links are not rewritten

UPDATE: when selecting images in the media library, the view command leads to a wrong URL in the form of domain-name.com/image, though the actual URL is properly stored on the image details. On my ...
1
vote
0answers
14 views

“View post” leads to odd URL

On one of my sites, pressing "View post" from the back-end creates an odd URL, always taking the user to the homepage. The correct URL shows when you mouse-over the link - for example - www.trunk....
0
votes
0answers
17 views

i need to rewrite a custom URL

i want to rewrite this url: example.com/ygal/1 to be pointed to: example.com/?vk_callback=1 add_rewrite_rule('^ygal/(\d+)/', 'index.php?vk_callback=$matches[1]', 'top'); I have press on save setting ...
0
votes
1answer
27 views

How to add logged in username after WordPress URL?

I found a great solution for this issue in this article: How to add wordpress username after url? /* Plugin Name: My Awesome Button Description: The shortcode [my-awesome-button] will be replaced ...
1
vote
1answer
13 views

Change URL of posts and also Custom Post Type

Right now I have changed the posts url using the settings -> permalink i.e /blog/%postname%/ I have now added a CPT and using the rewrite 'rewrite' => array( 'slug' => 'custom-posts' ), but the ...
0
votes
1answer
26 views

Custom author url and page for another role

I would like to create a custom url and a separate or duplicate the author.php template for another custom role w/o using plugins. I found this related topic but it just modify the author url ...
0
votes
0answers
16 views

Add #primary at the end of navlink permalinks on single posts

I'm trying to add #primary at the end of the permalinks to the previous- and next post on all single post pages, to jump past the header directly to <div id="primary"> when going to the previous ...
0
votes
0answers
23 views

404 Rest Route not found - when serving behind “proxy”

To avoid CORS and speed up my static site, I have made a "proxy" from my static site. Basically, I can make a request to: staticsite.com/wp-json/some-endpoint and it fetch and return the response ...
0
votes
1answer
15 views

Dynamic URL with rewrite rule not working

I'm trying to update my link from this: https://dev.brunchwork.com/next-event/?eb_event_id=106098978902 To this: https://dev.brunchwork.com/next-event/[guest_name_here]/[event_id_here] Following this ...
0
votes
0answers
14 views

Multisite register url got 403 error

I have a Multisite wordpress installed by "subdomain" configuration. My main site and sub-sites and all of addresses works correctly Except the Registration url: http://site.example.com/wp-login....
0
votes
1answer
13 views

Current WordPress Page Title as Search Parameter into A Tag <a href=“www.domain.com/s?=currentpagetitle”></a>

i would like to include an affiliate link as a widget which inserts the title of the respective page as search parameter. <a href="www.amazon.com/s?=titleofthepage">Link</a> I have ...
0
votes
0answers
12 views

rewrite the url keeping the previous one

I would like to understand if it is possible, through add_rewrite_rule, to do this: a user types: https://example.com/username the user sees the page: https://example.com/author/username the url ...
0
votes
0answers
7 views

Looking to Have Custom Permalink For One Post Category, Removing The Base

I have custom permalinks setup with blogs/%postname%/ for the Press category I need it to just be /%postname%/ I've tried a few post re-writes of permalinks but I couldn't find one that removed the ...

1 2
3
4 5
39