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?
- WordPress Migration: Getting 404 Errors: Only Home Page works
- Custom post type 404s with rewriting even after resetting permalinks
- External page integrated into WordPress returns a 404 error
- WordPress Theme’s 404.php not found, server defaults to Apache’s own 404 page
- get_the_ID() gives notice in 404 page
- How to open the 404 page in the Theme Customizer preview?
- Proper method to restrict non logged users into certain pages
- Feed 404 Errors
- How to trigger 404 for custom query var?
- 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
- In wordpress I am manipulation 404 response. I want to give the response before 404 error is given to google
- 404 error on homepage when using Nginx proxying to Apache
- WordPress site displaying 404 for any page apart from index
- How to debug removal of rewrite rule flushing?
- WordPress monthly archive links result in 404
- Non “WordPress” pages/code getting 404 error
- 404 error on all pages but homepage
- Where does the 404 redirection happen?
- Where is the best part to hijack or catch a potential 404
- page not found in Chrome, but found in Firefox
- Why does my WordPress show a 404 message for 403 forbidden directories?
- Moved to new server, all pages work EXCEPT home page (page not found)
- High CPU usage on 404 errors
- How to fix “failed to set referrer policy: The value ‘ ‘ is not one of…”?
- “Lost password” page triggers 404
- Multisite installation on IIS gives 404 trying to access the admin dashboard
- 404 to 301 – Fixing old links
- Why specific file directory fails to redirect but its parent folder succeeds?
- Custom Post Type rewrite rules not working, how to alter the rewrite order?
- How do I bypass WordPress 404 handling?
- Can rewrites fallback if 404? Rewrite conflict issue
- How do I go about fixing this apparently messed up upgrade?
- WordPress Stats keeps showing non-existent post as a top post?
- WP Rest API not working
- What does do_action(‘admin_init’); does actually?
- Form in WordPress : 404
- Why is my Javascript console showing a 404 error for a file called “null” on a clean WordPress install?
- Why Runtime service worker (runtime-service-worker.js) is being loaded, but can’t be found?
- Non-existent page returns code 200
- WP is redirecting instead of going to 404
- Using category slug in add_rewrite rule
- Conditional for 404 page not work
- Nginx with WordPress not showing template 404 for certain file types
- post parameter ‘name’ 404 error
- Intermittently missing pages and posts in WordPress
- Getting a 404 in Debugger for example.com/wp-admin/Array?
- 404 error- issues with pages after adding custom rules for posts
- 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?
- Intercept 404 and try to serve another content if exists?
- 404 after moving localhost wp to server
- Custom Permalink
- How do I show the WP admin error page?
- WordPress takes too long to show 404 error on images (on LEMP stack)
- WordPress Post – On Post – 404 Page Not Found
- How to find out which function is causing a 404
- Prevent WordPress from interpreting a subfolder?
- Getting 404s on New Pages
- How can I send an email in my plugin?
- index2.php in root causing 404 error
- Why I get File Not Found (404 error) when the file is actual there?
- Adding rewrite rule dynamically
- WordPress shows front page, when it should show 404 with pagination style urls
- WP_DEBUG must be on, otherwise edit post or page will show 404 error
- URL Rewriting for PHP script on an image URL
- Getting “404 page not found” error when i access to my Login page
- Virtual robots.txt missing
- Moved from Blogger to WordPress, however I can only see the Google 404 page
- Custom 404 page for dashboard
- wp-tinymce.php 404
- WordPress.org support topics returning 404 [closed]
- Display child pages on parent page: 404 message overrules shortcode in page
- URL rewriting with custom user meta “/%shop_name%/gallery/%gallery%”
- Multisite sub-directories IIS 7.5 change media/uploads location
- How can I prevent non-existing wordpress pages from getting redirected to home page
- Incorrect url for sharing blog on linkedin [closed]
- Catch 404 errors in nested installations
- Pre-Populate $wp_query settings with custom rewrite rules and custom template_redirect
- WordPress 404 Page displaying on a sub directory that has it’s own 404 page
- redirect deleted / drafted pages
- 404 error on dynamic stylesheet creation
- Why do I have a weird rendering issue only on 404.php caused by wp_nav_menu?
- make wordpress log errors in apache log file
- How to fix: “The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.”
- Page not found (404 Error) even if the page exists?
- WordPress refuses to read the .htaccess file and gives a 404 for sub-pages