Answer the question
In order to leave comments, you need to log in
How to remove Nothing found on a custom Wordpress page?
I want to make a page with a specific url on which a message will be displayed.
add_action( 'template_redirect', function() {
global $wp_query;
if ($_SERVER['REQUEST_URI']=='/lalafa') {
if ($wp_query->is_404) {
$wp_query->is_404 = false;
}
header("HTTP/1.1 200 OK");
wc_add_notice( __('Thank you.', 'my-space'));
}
});
Nothing Found
It seems we can’t find what you’re looking for. Perhaps searching can help.
<<и здесь форма поиска>>
Answer the question
In order to leave comments, you need to log in
1) endpoints are used for this.
2) ok, you hung up on 'template_redirect' and what template are you slipping? You have the same 404.php and it remains.
add_action( 'template_include',function($template) {
if ($_SERVER['REQUEST_URI']=='/lalafa')
return __DIR__.'/thank-you.php';
return $template;
});
<?php get_header() ?>
<div style="display:flex; align-items: center; justify-content: center; min-height:400px; ">
<h3 style="text-align: center;">Thank you man</h3>
</div>
<?php get_footer() ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question