WordPress plugin structure – 404 replacement feature
-
I need to create a custom WordPress plugin that “talks” with a separate PHP application. When the user types a URL that does not exist on WordPress, I want WordPress to check whether my other PHP app has some HTML content to render (if yes, then render it) before WordPress throws a 404 error.
Here is the current file structure:
mysite.com -> a basic WordPress site mysite.com/app -> a complex php app (PHP, MySQL, CodeIgniter)When the user visits a page that does not exist on my WordPress, i.e:
mysite.com/user.profile/I want WordPress to run a function (before the 404 error) that checks whether the app has some valid html data to render in that specific page. If the app responds with some HTML, render it, if not, display the 404 error.
QUESTIONS:
1) How can I accomplish this with a custom WordPress plugin? (hooks, filters, etc that I should keep into consideration? – I’m not a WordPress plugin expert)
2) Should I write an API or use a dirty PHP include to let 2 systems talk to each other? (they’re on the same server as shown in the file structure)
3) Sitemap: this is a tricky question for developers. Do you think that it would be easier to generate a separate sitemap (for those pages only) via the /app or via WordPress?
The topic ‘WordPress plugin structure – 404 replacement feature’ is closed to new replies.