I have a search form on my site to find specific articles, the search functions are included in the theme folder


the search.php file is included in two files where the actual form is.

For one particular users I need to make a change to a single line in the search.php file in a function, I have tried using a child theme and adding the amended file in the root, including it from the the child function file causes lots of 'function already declared' errors, presumably because the functions are declared in the parent search.php file and now being re-declared in the child search.php file.

How can I get this updated file or function to override the the file/function in the parent theme.

  • what theme are you using? what is the code to include the search template into those two files? what is the full code of the search.php?
    – Michael
    Commented Apr 7, 2017 at 20:31
  • How are you defining which user sees the changed form?
    – Cedon
    Commented Apr 7, 2017 at 20:33
  • It depends on whether the parent theme has it defined as a pluggable function. This may help: mhthemes.com/support/…
    – WebElaine
    Commented Apr 7, 2017 at 20:37
  • @Michael The theme is a custom one, the search templates it referenced from the search form which is a widget that goes on any page. The full code of the search.php is too long for here.
    – Naz
    Commented Apr 7, 2017 at 21:18
  • @belinus I am forking the theme for this user.
    – Naz
    Commented Apr 7, 2017 at 21:19


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.