117 reputation
12
bio website subsquare.at
location
age
visits member for 1 year, 10 months
seen Jan 30 at 16:23

Nov
8
awarded  Benefactor
Nov
8
accepted Pagination broken when merging search results with additional WP_Query
Nov
8
comment Pagination broken when merging search results with additional WP_Query
Great, thanks, that one is working! Not the most performant solution (especially as 'year=2012&monthnum=12&day=12' is being replaced by the actual search term) but I really appreciate you found a way doing it.
Nov
8
answered Pagination broken when merging search results with additional WP_Query
Nov
8
comment Pagination broken when merging search results with additional WP_Query
It seems there is no way to bypass a 2nd query. So to summarize: I was aware of those filters/hooks but looking for an answer which focuses on a specific, working/proven implementation because there are plenty of side-effects. Still give you +1 for your efforts, thx!
Nov
8
comment Pagination broken when merging search results with additional WP_Query
Filter the main query: I'm already filtering the main query by using the "posts_search" hook. Yes I'm doing a meta query here already. And no, it's not possible to combine those queries there - as I outlined you can only perform SQL operations in those hooks. I have been using the "the_posts" hooks but still it's the same as I would modify the query in search.php. The "found_posts" hook is not needed as this can be done in "the_posts" already.
Nov
6
comment Pagination broken when merging search results with additional WP_Query
The first search results (authors) are posts which have a specific author name in a Meta field (custom field, not the standard user/displayname). The other posts may also have a value in this field but not the exact same value or no value at all. Therefore I'm not able to keep the desired order by a simple SQL sort.
Nov
6
comment Pagination broken when merging search results with additional WP_Query
I also assumed that I have to fake the pagination somehow and that I have to fake additional WP_Query properties. Still wondering what those properties are and if I have to merge the 2nd query "conditionaly" when the last page is reached? But there must be an easier way. And I've tried "@pre_get_posts" and "@posts_search" hooks which unfortunately work on the pre-query/SQL level only and therefore don't keep the order I intend.
Nov
6
comment Pagination broken when merging search results with additional WP_Query
Thanks for your answer sam! But as G.M. pointed out correctly, I want to keep the given order defined by the query execution (authors first, other posts at the end). I understand that the "$otherposts" are below because of the merge but I'd like to find a way to merge that those posts are appended on the last page.
Nov
5
awarded  Promoter
Nov
5
revised Pagination broken when merging search results with additional WP_Query
added 35 characters in body
Nov
5
revised Pagination broken when merging search results with additional WP_Query
emphasis on goal
Nov
5
revised Pagination broken when merging search results with additional WP_Query
improved formulation
Nov
5
revised Pagination broken when merging search results with additional WP_Query
added code comment
Nov
1
awarded  Critic
Nov
1
asked Pagination broken when merging search results with additional WP_Query
Dec
27
comment WP_Query ignores post_type in category view
Thanks for the notice, Simon. Meanwhile I've solved it with a different query. Will come back to you as soon I'm refactoring this part.
Dec
17
awarded  Excavator
Dec
17
revised Template Tag “template_directory” pulling wrong path
fixed code example
Dec
17
suggested suggested edit on Template Tag “template_directory” pulling wrong path