First, your code attempts to use $_POST['nom']
whether the value is set or not. You are generating non-fatal “Undefined index” warning every time that runs. Clean that up and use !empty($_POST['nom'])
instead of $_POST['nom']!=NULL
.
With template_redirect
you’d want to redirect to an existing page, something like the following from another answer:
function redirect_cat_wpse_207298() {
if (is_category()) {
global $post;
wp_safe_redirect(get_permalink($post->ID));
die;
}
}
add_action('template_redirect','redirect_cat_wpse_207298');
Since you say “create a page”, I am guessing there is no page to redirect to, so you probably want template_include
instead. Something like:
function recherche_multi_critere() {
if(!empty($_POST['nom'])) {
get_header();
var_dump($_POST['nom']);
get_footer();
}
}
add_action('template_include', 'recherche_multi_critere');
Related Posts:
- Redirecting wordpress search query to archive page
- Including categories in search results
- Search Custom Post Type Pages and Custom Fields in 2 Dropdowns?
- Display all search results
- How to display comments and comment form on custom post type?
- Search posts by post author name
- I am trying to create a simple frontend form for posting
- Search not working with title and content
- how to hide specific post from google search
- POST from jQuery to PHP
- How to search only by post title and category?
- Search widget breaks when using multiple loops?
- Phantom 302 status code when sending a POST requests on pages
- Pagination not working on custom query
- How can I get all posts data from within a paginated search result?
- How to automate filing a form as a user
- Search query – exact post title match
- pagination hook doesn’t work with search results
- Submitting POST data to a custom page template triggers a 404, why?
- Search for posts based on their url in the admin?
- wp_query ‘s’ parameter does not work with custom post type
- Differentiate between posts and pages in search results
- Count search results in heading
- Private Posts/Pages & Search
- Display number of posts via adress bar?
- Tags to Post-ID mysql query. Tag Search
- Ajax posts filter by date, comments, top views, top likes
- How to change wordpress dates to native language (even if the languge not available i wordpress)
- Is it possible to create a form post wordpress custom navigation link?
- Redirection not working in this front end post submission form?
- How to build a site with a map that shows where people offer and need help?
- CF7 upload file failing [closed]
- How to filter my search in post if contains a word in title, content or excerpt?
- Search results posts_orderby and ID
- How to convert contact form 7 submission to post after submission? [closed]
- Posts and Attachments with “Published” status in Search
- How do I change the core post search algorithm? Where is it found/constructed?
- redirect to uploaded (wordpress) post after form submission from front-end
- How to add add more properties to WP_Post object in search results loop
- Refresh problem post is duplicated when page is submitted after page reload
- Total number of posts in query (category/tag/author/search results/main page…)
- See if a post has a specified tag
- Post Form Results to Table in Same page
- HTML Form Submit to table in same page
- How to get the form code from the edit page of a specific post?
- Why does WordPress search returns same number of results for every search query?
- Hide parts of the post content after typing it’s name or searching it by category
- search content of pages and list in wp-admin
- How to exclude the word “class” from being matched in search?
- In admin panel, use a form to create a post?
- Standalone form does not post to the url when form fields are populated (otherwise it does)
- Will multiple category descriptions effect my search engine optimization?
- What would causes search to return incorrect results?
- Mailing list submission from a post that doesn’t have a form on it
- I want to add another search box on posts page in dashboard
- How to let a user create a post by submitting a POST form?
- Showing Posts if non are found
- search form for custom fields
- How can I pass form entry to another form on a new page
- How to show posts in grid style on search result page?
- Search results with pagination not working
- Not adding a new post?
- How to show only homepage in google results instead of privacy, contact pages
- How to search through “post title” and “tags” using WP_Query?
- How to create custom search form function including post “tags”
- How can I create a Survey Form in WordPress that users can fill in and then submit the entire survey contents as a post?
- WP Ajax returning 0, can’t find action
- Remove pagination if search returns empty
- How do i search post by jquery datepicker?
- How to get value of a selected option from select tag and use it in WP_query to filter posts?
- show only one category and filter by tag
- On WordPress Search, how to search post from Author meta also
- Secretly passing post ID/title etc into a shortcode form automatically to link submission to post
- Creating a frontend blog post form for logged in users only
- How to hide meta from search result only on pages?
- Ajax the create and edit post form into lightbox and get results
- Find post tags words in post content and link them to tag URLs
- Custom author search
- WordPress search for specific Post Type
- Changing a field value on submit using a PHP variable
- Customize search results to include custom posts and display in a specific template page
- Save/retrieve form data best practises for theme development
- form to post multiple inputs into post_content
- User driven content problems
- How can i retrive the movies, trailers, news in a single page using search
- Custom Post Title as search term
- How do I insert a custom field in a user submitted post?
- Related posts by searching post tags of single post as terms
- Can’t assign another category other than Uncategorized int he following front end post submission form?
- Get Video Attachment to post
- How to get only post=’product’
- How can I add a custom caclulation form in post?
- Search doesn’t display posts with images
- Filter/Sort Post Form On Taxonomy page
- Code understanding
- How can I customize wordpress content egg searh form?
- Get WordPress post content by post id
- Get page ID of page that is set as the posts page
- Get Posts Under Custom Taxonomy
- How to limit the number of posts that WP_Query gets?