Suggestion:
I suppose that you have a backend interface that use custom fields to do this.
Don’t use permalinks in this fields, instead save the post_id of the page that you want to link in the custom field and use get_permalink()
in your code
Example:
Custom field name: link_to_page
In your code, use, for example
echo get_permalink(get_post_meta($post->post_id,'link_to_page',true))
In the backend, you can use custom meta boxes. See this article for reference on how to implemente custom meta boxes
Related Posts:
- Getting the Site URL Including the Front Base
- How to get rid of index.php?
- How to bulk edit image url in featured image and product description?
- Permalinks settings
- WordPress suddenly changed all links to example.com/example.com/
- home_url on IIS missing permalink index.php
- Permalink not changing according to post type
- Got 404 error when changed siteurl via DB in WordPress
- Logging in to installation in subdirectory renders broken dashboard (no CSS, broken links)
- My permalinks for all pages and posts now include old page titles as parents/categories
- Remove index.php from URL (WP installed in subdirectory)
- How to change URL of my pages?
- Remove index.php from URL
- permalinks url with woocommerce
- Siteurl code for links
- Changing permalinks gives me 404 errors on nginx
- Strange permalink issue: can’t rename /company-2/ to /company/
- How to get permalink and title from post ID?
- Using $_GET variables in the URL?
- Removing leading zeros from custom permalink structure
- Move WordPress to subdirectory, keep ALL URLs
- How do I turn off 301 redirecting posts (not canonical)?
- How can I include a query string with get_permalink
- Without index.php in permalinks I get 404 across site
- Permalink: postname EXCEPT for blog
- %tag% in permalink not working
- How to assign a Permalink to a Function
- Rewrite rule never matching
- How to get blog id from permalink?
- Custom url for a single page
- Rewrite-Rules not working on a vhost, everything goes to index.php
- Date archive permalink modification
- Using ‘Primary Category’ in URL
- query_vars in plugin not working?
- echo post-permalink without http and www
- How to get permalink in foreach loop
- CPT Post Title Permalink: Replace “@” (or all special characters) with dash “-” instead of just removing
- Disable permalinks on all pages and posts
- Why is add_rewrite_endpoint incompatible with /%category%/%postname%/ permalink structure?
- Custom permalink for search and pagination
- Rewrite Rule for default post type
- WordPress permalinks that end with a hyphen result in a 404
- get permalink of page children in loop
- Confusing about permalink
- Programmatically Restrict WordPress from using certain URLs or sub-directories
- Title attributes on Permalinks for posts and products
- How to include sub directory in sitemap? [closed]
- Post preview gives 404 when permalinks are purely date based
- Custom $_GET vars in wordpress entry with permalink
- WordPress Not Using Template Files After Permalink Update
- Permalinks only for posts
- rewrite rule to redirect to the most recent date permalink
- How to link the title adding a permalink?
- Visiting posts results in 404 errors after host migration
- Suddenly new posts have the default permalink instead of the post name
- Permalink Settings
- rename ‘page’ URL fragment in pretty permalinks
- Can’t get permalinks working!
- Redirecting “wrong” but working links to their canonical URL in order to prevent search engine penalties (e.g. /123/ at the end of URLs)
- WordPress not generating .htaccess but tells me that (Permalink structure updated.)
- Permalink with anchor on home page to single page
- Add category into post permalink
- How do I keep multiple domain for my wordpress site
- Custom permalink structure with %postname% in front of domain name
- how to set up wp in folder within static website?
- Create custom links for excerpts with php dynamically
- placing the media uploads in a subdirectory
- Permalink Structure not updating .htaccess
- Multiple sites with pretty permalinks with nginx
- mod-rewrite rules grabs “broken permalinks”, too
- Creating an alternate path for a page
- Permalinks causing wp-json to 405
- Parent/Child Categories Permalinks
- How to change URL from /%postname%/ to custom-name/%category%/%year%/%monthnum%/%day%/%postname%/
- How to prevent wordpress from lowering Capitalized letters
- WordPress Multisite ABSPATH and get_home_path() to check for htaccess or web.config file
- Disable -2 Permalink Addition
- Permalink in relation with the files
- Every sub page shows Error 404, i have check permalink but still same issues
- Permalink structure /page/page/cpt-post gives 404 with pagination
- Changing permalink structure for Posts
- Allowing slash in slug/permalinks
- Author permalink
- Multiple Permalink Patterns for one page
- When is a good time to reset permalinks?
- WordPress permalinks first word title
- WordPress permalink issue on AWS
- Permalink for Author’s Posts in a Category
- Search and replace post URL’s on page output?
- WP Admin Bar not showing with custom permalink structure for pages
- WordPress Pagination Not Working After Transfer from Localhost
- Why doesn’t WP update my .htaccess file?
- How is a URL getting mapped to a page template
- What is the issue with our links? It creates a loop
- Routing ‘fake’ sub sub posts
- Page and post auto links
- how to make follow?
- Permalinks Won’t Work
- Remove parent product category slug from product_cat url woocommerce
- How to make my custom permalink pull up the correct post