page_link
is not going to work as even though you change what it shows or uses, that’s not going to be detected when the URL is accessed — which requires handling to parse it during the request.
You could look at adding rewrites, or what is probably easier you could use try using something like this (or view their code to see how they do it):
https://wordpress.org/plugins/custom-permalinks/
Here’s how they are doing it:
https://plugins.trac.wordpress.org/browser/custom-permalinks/trunk/frontend/class-custom-permalinks-frontend.php
Related Posts:
- How to filter to output of the get_permalink() function
- WP JSON list all permalinks
- Filtering comment permalinks when a condition is met
- Remove the Parent category from the permalink but leave the child category
- How to hook into permalink when publishing-saving post?
- Multilanguage URLs
- How to change the permalink option to post name on theme activation?
- Changing post content on save, using updated fields
- is there a way to add the post URL to the results of fselect facet in Facetwp plugin?
- Process all virtual sub pages on parent page
- Permalink slug no longer editable when using post_type_link filter
- WordPress Permalink feature alternative
- Access or edit custom generated permalinks with WP_Rewrite
- Custom child page permalink
- Remove character from permalink
- Edit the output of a filter
- Fire a code when permalinks updated
- Edit Post Permalink option removed, looking for possible causes
- I can get the permalink or the excerpt to work correctly, but not both
- Search and replace post URL’s on page output?
- Custom Permalinks and filters?
- Once redirected by Rewrite rules, how can WordPress know the page?
- How to update permalink on the fly?
- Getting the terms from “Beautiful Taxonomy Filters” Results ot Integrate into “Ajax Load More”
- Rewrite permalink with PHP processing
- 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
- How can I include a query string with get_permalink
- Post being redirected to attachment post
- Without index.php in permalinks I get 404 across site
- Changing Permalinks to a Custom Permalink causes a 404 Error [no matter what I do]
- How to assign a Permalink to a Function
- Date archive permalink modification
- How to get this JavaScript working with get_permalink
- Change of permalink structure – redirects in htaccess breaks the archive links
- Filter string like a slug
- 404 with post name permalinks
- Should there be a trailing slash in the permalink
- Link to external URL
- Woocommerce Product Attribute Permalink doesn’t work?
- Problem with wordpress links on a live site
- Permalink change redirects by WordPress [duplicate]
- WPML get permalink to the translated post from the original post
- page nested 3 levels deep shows 404
- Removing /author/ slug from URL gives 404
- Add custom post type name in term link?
- Can I create permalinks like this: /%post_type%/%postname%/
- Why the “Permalink” option is not showing in the “Settings”? [closed]
- How to get the full URL of the current page and change domain of it?
- Custom permalink structure: /%custom-taxonomy%/%post-name%/ (without CPT slug)
- get_permalink() is not working after published
- How can I get this custom post type permalink structure? %custom_post_type%-%taxonomy%-%term-postname%
- get_permalink returning site home url instead of the url of slug being passed
- WordPress add_rewrite_tag working for Posts, but not working for Pages
- Host frontpage via example.com and everything else via example.com/blog
- WordPress can generate numeric permalinks, which then 404
- 404 error using Meta for Permalink rewrite
- How to handle paging/pagination with a custom permalink?
- Environment independent way to link to certain pages on frontend
- Using one slug/post-name for multiple pages
- Custom URL rewrites for templates
- Gutenberg output URL to post from attribute with post ID
- Broken wordpress site, non-working links and no access to wp-admin page
- Permalink with anchor on home page to single page
- Add category into post permalink
- Add post overwriting permalink from previous post in 4.6
- How do I keep multiple domain for my wordpress site
- Custom permalink structure with %postname% in front of domain name
- What is the right way to clean up $title before wp_insert_post?
- Create custom links for excerpts with php dynamically
- placing the media uploads in a subdirectory
- mod-rewrite rules grabs “broken permalinks”, too
- How to allow slash(/) on page url
- Creating an alternate path for a page
- Permalinks causing wp-json to 405
- Parent/Child Categories Permalinks
- Custom Permalink For Custom Post Type – Working Fine But Broken For Pagination
- How to prevent wordpress from lowering Capitalized letters
- An excluded ‘ghost’ page is crashing my permalink
- 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
- Allowing slash in slug/permalinks
- Custom Permlinks work, regular page permalinks don’t
- Multiple Permalink Patterns for one page
- When is a good time to reset permalinks?
- Permalink for Author’s Posts in a Category
- WordPress permalink setting
- Two urls for one website
- WordPress Pagination Not Working After Transfer from Localhost
- Accidentally changed the permalink structure
- How is a URL getting mapped to a page template
- customize urls displayed by previous_post_link and next_post_link
- Routing ‘fake’ sub sub posts
- Page and post auto links
- how to make follow?
- Permalinks Won’t Work