Timeline for WordPress thinks my custom route is a 404
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 3, 2021 at 20:44 | answer | added | 2046 | timeline score: 0 | |
Mar 2, 2017 at 4:27 | comment | added | Milo | Here's an example of an approach that short-circuits the query parsing phase and doesn't produce a query that's just doomed to fail. | |
Mar 1, 2017 at 19:27 | comment | added | Ahrengot | That's just not always an option. For instance, if I want to provide a "My profile" frontend page for my users where they can update basic information about themselves. There's no post associated with such a page, but I still need a URL for it. In any case, I figured out a solution and posted my answer below. | |
Mar 1, 2017 at 16:08 | comment | added | Milo |
Rewrite rules have to result in a successful main query. If my_custom_url is not the slug of an actual page, you will get a 404. If some_id is a valid post ID, then set the correct native query vars with that ID so the query succeeds.
|
|
Mar 1, 2017 at 15:54 | vote | accept | Ahrengot | ||
Mar 1, 2017 at 15:54 | answer | added | Ahrengot | timeline score: 3 | |
Feb 18, 2017 at 0:57 | history | tweeted | twitter.com/StackWordPress/status/832755991397625856 | ||
Jun 2, 2016 at 10:16 | comment | added | Ahrengot | Yes. Flushed the rewrite rules. Both manually and in the plugin's activation hook. | |
Jun 1, 2016 at 13:30 | comment | added | jgraup | Did you flush your rewrite rules? codex.wordpress.org/Function_Reference/flush_rewrite_rules | |
Jun 1, 2016 at 12:03 | history | asked | Ahrengot | CC BY-SA 3.0 |