[wp-trac] [WordPress Trac] #46394: Create a Function to Allow the WordPress Search to Only Return Results from a Specified Post Type

WordPress Trac noreply at wordpress.org
Fri Mar 1 17:24:37 UTC 2019


#46394: Create a Function to Allow the WordPress Search to Only Return Results from
a Specified Post Type
-----------------------------+-----------------------------
 Reporter:  pauljohnknight   |      Owner:  (none)
     Type:  feature request  |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  General          |    Version:
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 Hi

 I'd like to install the WP search box on a custom post type archive page
 and have it only return results from this custom post type.

 Is there any way in the future WordPress could allow you to add a
 parameter to the get_search_form() function (or create a similar function)
 that would allow this?

 An example being, if I had a custom post type called jobs, when I add the
 WP search box on the jobs archive page I could add 'jobs' as a parameter
 so it only returned matches from the jobs post type i.e.
 get_search_form('jobs')

 This would be so awesome.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46394>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list