I have a home page. I have integrated search functionality on home. its works fine. when i have searched, url displayed http://localhost/site-name/?s=searchTerm. But when i have accessing inner page of website and i have search, url displaying is http://localhost/site-name/pageName/?s=searchTerm. How should i redirect to http://localhost/site-name/?s=searchTerm
Set the search form like below. add the action equal to WordPress home page URL esc_url( home_url( '/' ) );
<form method="get" action="<?php echo esc_url( home_url( '/' ) ); ?>" class="" id="">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With