WordPress Search Results Programmatically
I want to enable the output of auto search results to my 404 page based on the url that the user enters.
The problem is, in a normal search.php file, wordpress gets the value from the url parameter and uses a regular loop like this:
<?php while (have_posts()) : the_post(); ?>
<h1>Search Results</h1>
<a href="<?php the_permalink() ?>"> <h2><?php the_title(); ?></h2> </a>
<?php endwhile; ?>
How do I get it so that I can manually enter the search term into the code?
Great importance.
+3
source to share
1 answer
Do you want to automatically search for the value from the url? perhaps you can show your similar post with this value or show them a recent post with a search form using search for your site and google.com. maybe this link can help Built in effective 404 error pages
Hope for this help,
+1
source to share