Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
0
votes
1
answer
90
views
Load a specific post if user tries to access 404 page
First, I'm not trying to redirect the user as I don't want the URL to change - think of it as an include rather than a redirect. Second, I would want to have control over the content, title, etc. So t …
1
vote
Accepted
Load a specific post if user tries to access 404 page
This is the final code that works. I had to set $wp_query->is_single = true; manually:
add_action( 'template_redirect', function(){
global $wp_query;
if ( is_404() ){
$id = 1; // the p …