Ready to get started?Download WordPress


Change the default action attribute in my search form? (3 posts)

  1. jircas
    Posted 11 months ago #

    the current search form:
    <form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">

    is there possible to change action attribute from default page to other assigned page?

  2. Zakir Sajib
    Posted 11 months ago #

    yes possible.

    if you have page called search.php then you can use this in action.

    Better to have/create a page in dashboard by same name(Search) and in action you just put "search"

  3. jircas
    Posted 11 months ago #

    Thanks, Zakir,

    search.php is control result format. In my website, wordpress default search result format is OK. What I truly want is display search results in the same page if I put a search form in a page. I don't want search results show up in the front page, where the wordpress defualt sets. In this circumstance, if users want to make search again, they need find the original page. (My search is category specified search, not wordpress default search.)

    Could you give me more detail suggestions?


You must log in to post.

About this Topic


No tags yet.