The simplest thing to do would be use non–pretty permalinks.
It is often overlooked, but you can just form a link like example.com?p=123
and WordPress will understand it and automagically redirect to pretty permalink too (if enabled, which is typically is).
Only need site URL and ID for the post, no PHP calls, no complex stitching it together from data.
Related Posts:
- Changing permalinks gives me 404 errors on nginx
- Does WordPress automatically do 301 redirect if I change permalink
- Move WordPress to subdirectory, keep ALL URLs
- ‘post_type_link’ filter not working
- Update URL Snippet to Canonical Permalink URL
- WordPress permalinks Yahoo hosting(no .htaccess allowed)
- How do I turn off 301 redirecting posts (not canonical)?
- Permalink: postname EXCEPT for blog
- %tag% in permalink not working
- Change website URL without breaking links or images? WP 3.3
- How to identifty post from its URL in 404 page?
- Rewrite rule never matching
- How to get blog id from permalink?
- Custom url for a single page
- Search result permalink
- Permalinks Structure and 404 Question
- Rewrite URL for results of a custom WP_Query
- Using ‘Primary Category’ in URL
- template_include not loading -instead goes to index.php
- WordPress installation in subfolder not working with nginx
- I need a custom permalink for my website
- Clean install – Changing permalinks in twentyeleven give 404
- How to link to “most recent” document in the Media Library?
- Permalinks not working
- Adding page links to content that automatically convert to pretty permalinks?
- Need Help Correct Regular Expression Redirect Code
- Why wordpress multisite root site showing blog prefix by force?
- issue with setting up permalink programmatically
- changing permalink for custom template in posts of a certain category
- Force wordpress to display page with same url structure as categories
- WordPress post-name permalink redirects to site.com
- WordPress Pages Redirecting to Root with WordPress Multisite (Sub-Directory)
- is there a way to add the post URL to the results of fselect facet in Facetwp plugin?
- NGINX serve WordPress from sub-path fails with 404, how to fix?
- Redirect /%year%/%monthnum%/%day%/%postname% [closed]
- How to get functions.php work with postname permalink?
- Woocommerce subcategory 404
- WordPress always returning 404 page for a specific url
- WordPress Automatic Update to 3.9.1 breaks Permalinks [closed]
- Static Text in Permalink
- Pre-populate Slug / Permalink with URL
- Dynamic Custom Permalinks
- Allow Permalinks to Work with and without Hyphens
- Problems with rewrite rule
- How to Custom Edit Post Title & Permalink Slug?
- Problem with parent page slug only in WordPress admin
- How do I remove /wordpress/ from my permalinks?
- “-2” Being added to end of URL (no duplicate pages, no pages in trash)
- Relative links in Gutenberg
- Page found with “Plain” permalink but not with “Post name”
- Post Name Permalink setup gives 404 error inside sub-directory
- Why is my RSS feed not working?
- Convert single apix to dash in permalinks
- Page redirect to 404 when set Permalink = “Post Name”
- How to remove the link of an image on WP 4.2
- How to enable http (not just https) in wordpress?
- How to get raw unwritten querystring
- Is there a way to show attachment IDs on the attachment info screen?
- Keep permalinks in WordPress
- Need to capture “keyword” added to the end of the post, even with “pretty permalinks”
- Can not manually change the permalink of a post in the EDIT secion
- How to change permalinks to show categoryname/post-name?
- Post with no tag permalink problem
- What permalinks do I use in the redirection
- WP Multisite Subdirectory Custom Permalinks 404
- WordPress’ «post name» setting broken
- Whole site’s pagination not working after rewriting product permalink
- Convert $ _GET to permalink
- Permalink blog page (only) not working
- Link to a page before launch
- My WP homepage works, but the other pages don’t when accessing from out side of my network
- CPT links error: each one links to next one further along in the list
- How to change permalink for pages in WordPress?
- Disable “similar permalink” redirect [duplicate]
- Logging in to installation in subdirectory renders broken dashboard (no CSS, broken links)
- Woocommerce product page 404 not found
- Why aren’t my posts being saved or published?
- WordPress and NGINX – permalinks are not working with ending slash
- Get value from URL with different types of parameters
- a way to support totally different url structure
- Page permalink redirects to home page
- I have to specifiy port otherwise the website doesnt work
- Permalinks for thumbs with get_post_gallery
- Permalinks/Pretty links aren’t working on my site
- How to hide slug numbers with htaccess
- Permalink not working
- get_permalink wrongfully returns only year and month and not all the link
- Link to most recent child page
- Automatic -1 suffix being added to the permalinks of a page when the page does not exist
- Why doesn’t WP update my .htaccess file?
- WordPress permalink still not working (error or not understood?)
- Permalink for pages
- Pagination is not working, how to trace it properly?
- Problem when i configure permalink
- Getting the top level permalink using get_post_ancestors()
- What is the issue with our links? It creates a loop
- wordpress home is gone
- Post URL not working according to permalink setting
- Strip category base from URL?
- Does the error “A structure tag is required when using custom permalinks.” mean my permalinks haven’t saved?