Search only working on front page (index) , not working on other pages


I’m currently building a custom WordPress template and I’ve run into a problem with the search box.

When I use the searchbox from the homepage, it works as intended. It also works as long as Permalinks are set to default. (

However, when I use the searchbox from another page when using pretty permalinks, the URL looks something like this:
and a 404 page appears.

My search box code looks like this

<form id="search-query">
<div class="search-box">
<form role="search" method="get" id="searchform" class="searchform" action="/index.php">
<label class="screen-reader-text" for="s"><?php _x( 'Search for:', 'label' ); ?></label>
<input type="text" value="<?php echo get_search_query(); ?>" name="s" id="s" />
<input type="submit" id="searchsubmit" value="<?php echo esc_attr_x( 'Search', 'submit button' ); ?>" />

Here’s the site’s URL if anyone’s want to take a look:

Any help is very appreciated!

, , , , mizuki 3 years 2020-04-03T16:53:20-05:00 0 Answers 92 views 0

Leave an answer