Continue reading Searching for all descendants of a page

Searching for all descendants of a page

If you want to restrict a search to a page and all it’s children, you can add a post_parent parameter to the search, and that’s it – but that only includes the direct children of the page. What if you want to include page, it’s children, all the grandchildren and their children? In that case,…

Read more Searching for all descendants of a page 0 Comment on Searching for all descendants of a page
Continue reading Natural-language date queries

Natural-language date queries

I just wanted to be able to type in a date on the search and for the search to come up with all the blog posts for that date. This is one of those tasks that sounds really simple, but is actually complicated. However, this question piqued my interest and turns out it isn’t that…

Read more Natural-language date queries 3 Comments on Natural-language date queries
Continue reading Setting post_type to page doesn’t work

Setting post_type to page doesn’t work

For some reason setting the post_type query variable to page doesn’t have the desired effect. Other post types (post, custom post types) work, but page doesn’t do anything. This is not a Relevanssi bug, but a WordPress feature (see this trac ticket). If the user inputs a bad value to the post_type query variable, WordPress…

Read more Setting post_type to page doesn’t work 0 Comment on Setting post_type to page doesn’t work
Continue reading Changing the number of search results displayed

Changing the number of search results displayed

A standard way to change the number of search results displayed is something like this: Unfortunately, this breaks Relevanssi. Relevanssi hasn’t played nice with posts_per_page in any case, for some reasons I don’t really understand — this is legacy code from the original wpSearch plugin. However, from Premium version 1.4.4 and free 2.9.2, you can…

Read more Changing the number of search results displayed 47 Comments on Changing the number of search results displayed