• I try to modify search result by simply adding a parameter to it like shown here https://premium.wpmudev.org/blog/build-your-own-custom-wordpress-search/

    But nothing seems to work.

    I tried in a production website.

    I tried locally on a vanilla install of wordpress with Twenty Seventeen theme, etc. to see if it might be plugins (I updated all before testing), but no.

    Examples:
    https://localhost/~mickoz/temp/wordpress/?s=test&title=aa&post_type=product seem to ignore title and post_type (which doesn’t exist, but still return result)
    https://localhost/~mickoz/temp/wordpress/?s=test&post_parent=22223223 — expecting no result since post_parent does not exist but no, it ignores it, I tried with existing post_parent, same thing, it ignores it.

    Isn’t it supposed to work when the “s” get parameter is there? Is there something I have to do extra for this to work?

    Thanks

    P.S., If you are wondering about my goal, I want to create a custom search that search only in child pages of a given page (might evolve to filter by a category if the post_parent strategy doesn’t work). I saw that we should be able to alter a search result only by adding GET parameters, but it doesn’t seem to work as it seems to say everywhere… a bit surprised, but there is probably something I overlook or hmmm…

    • This topic was modified 5 years, 11 months ago by mmuryn.
    • This topic was modified 5 years, 11 months ago by mmuryn.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Alter search by adding GET parameter post_parent, etc. doesn’t work’ is closed to new replies.