Add custom content to nonexistent page
In your first example, you add the rewrite tag personal-development
, but then you use the rewrite tag class_type
inside your rewrite rule. That method would work if you fixed that error, and assuming 17318
is the page id of your personal-development
page. You could then use get_query_var('personal_development')
in the template or a template hook, to check what’s been requested.
add_action( 'init', 'dynamic_classes_class_type_rewrite' );
function dynamic_classes_class_type_rewrite()
{
add_rewrite_tag( '%personal_development%', '([^&]+)' );
add_rewrite_rule(
'^personal-development/([^/]*)/?',
'index.php?page_id=17318&personal_development=$matches[1]',
'top'
);
}
Related Posts:
- $error = 404 after caught add_rewrite_rule
- Intermittent 404 errors, rewrite rules, and BBPress
- Template redirect template loaded, but the header 404
- All pages after level 1 showing 404 after WordPress migration plugin – how to fix?
- Getting 404 error on my wp rewrite error
- URL Change – Check if Post Exists Before 404
- How to customize file path for 404 redirection in php?
- Intermittent Rewrite Problems
- How to create custom URL routes?
- External page integrated into WordPress returns a 404 error
- WordPress Theme’s 404.php not found, server defaults to Apache’s own 404 page
- Proper method to restrict non logged users into certain pages
- 404 when fetching image from wp-content/uploads/
- REST API: No route was found matching the URL and request method
- WordPress REST API 404
- Changing Site Address (URL) causes 404
- Detect 404 before headers are sent
- 404 error on homepage when using Nginx proxying to Apache
- WordPress site displaying 404 for any page apart from index
- Non “WordPress” pages/code getting 404 error
- Where is the best part to hijack or catch a potential 404
- page not found in Chrome, but found in Firefox
- Why specific file directory fails to redirect but its parent folder succeeds?
- How do I bypass WordPress 404 handling?
- WP Rest API not working
- Why is my Javascript console showing a 404 error for a file called “null” on a clean WordPress install?
- Non-existent page returns code 200
- WP is redirecting instead of going to 404
- Conditional for 404 page not work
- post parameter ‘name’ 404 error
- oEmbed 404 errors when trying to use embed block
- Should the actual /category/ directory be 404? Is that normal WP behaviour
- Hooking into the init action will fire it too frequently?
- 404 after moving localhost wp to server
- How to find out which function is causing a 404
- Prevent WordPress from interpreting a subfolder?
- Getting 404s on New Pages
- index2.php in root causing 404 error
- Adding rewrite rule dynamically
- WordPress shows front page, when it should show 404 with pagination style urls
- Custom 404 page for dashboard
- WordPress.org support topics returning 404 [closed]
- How can I prevent non-existing wordpress pages from getting redirected to home page
- Pre-Populate $wp_query settings with custom rewrite rules and custom template_redirect
- redirect deleted / drafted pages
- 404 error on dynamic stylesheet creation
- How to fix: “The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.”
- How to recover WordPress Adress(URL)
- Page not found – Wamp green, phpmyadmin working
- Custom rewrite to fetch feed data
- WordPress 404 errors for old plugin files via Google Bot
- WPML – 404 Error when I try to pass GET parameters in my “different languages in directories” installation
- How to use wp_footer() on a 404 page?
- How to direct user to actual 404 page when a check is false in single.php?
- Is the 404 page the same as “well this is embarrasing” page?
- Some users getting a 404 when previewing draft posts/pages
- WordPress Installation in Subfolder only works half
- 404 error when calling php
- Link to WP-CONTENT not working
- Multiple 404.php templates based on a post_type
- List all WordPress key words
- Site migration from Localhost to Server – 404 errors
- Custom Post Types cause 404 for pages? [closed]
- How to fix 404 page error on theme
- Site is working but we got 404 not found error in wordpress
- why I get a lot of 404 not found links via Google search console and how to fix them?
- 404 error when I tried to use author slug in url
- Please Help me with this 404 error
- Unable to change 404
- Redirect empty search to another page
- WordPress Admin page Error 404
- WordPress Inner pages giving 404 Error after shifted to new server
- Since moving HTTPS using cloudflare, the admin and login pages no longer work
- add_rewrite_rule() returns 404 page
- 404 on CSS and JS only on Homepage
- Getting a Error 404 Not Found on subcategory
- 404 Page not found error after adding ‘s’ in ‘http’ in Settings
- https images not displaying
- 404 Errors on Every Page (Including Homepage) After Migrating From IIS to Apache
- wordpress form action page not found
- Custom Rest API namespace and endpoints are responding with 404 & 503 errors
- My question:When I started my website, the “page not found” error always came up
- All files being pulled from wp-content returning 404 error
- Homepage URL showing a 404 error
- What could be the reason that i can’t access to the other pages of my localhost wordpress website except the homepage?
- Random 404 on any page
- 404 Page not Displaying
- Exclude from wp_list_pages by template
- How to get redirection to not redirect to 404 page?
- Local copy of site returns 404 for all content outside of core .php templates
- Install wordpress as a development site in a subdirectory on live server
- 404 errors in log showing urls with ‘GET’, plus and numerical code
- WordPress not showing custom 404 page for not found images, zip files
- 404 Not Found nginx on wp-admin
- except home page , all the links throwing an error “404 Pages Cannot be found” [closed]
- Can you redirect a 404 to a WordPress page and still show response code 404?
- Getting 404 error while file exists
- WordPress Site transfered to another Server. 404 all pages
- Unidentified 404 error [closed]
- Can’t link to pages from Home Front Page now. Get 404