Skip Navigation

[Resolved] Add a post relationship filter in a taxonomy Archive

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to add a post relationship filter to a taxonomy archive, but I see an error message, "The ancestors argument does not end with a valid parent for the returned post types on this View".

Solution: It is currently not possible to add a post relationship custom search filter to a taxonomy WordPress Archive. You could create a custom search View instead, and add that View into the WordPress Archive. Remove everything from the loop of the WordPress Archive. Filter the View by post relationship and term, passing the term into the View using a shortcode attribute and the wpv-taxonomy-archive shortcode.

[wpv-layout-start]
    [wpv-view name="classes-filtered-by-rabbis" wpvclasspostcategory="[wpv-taxonomy-archive info='name']"]
    [wpv-items-found]
    <!-- wpv-loop-start -->
                <wpv-loop>
                </wpv-loop>
    <!-- wpv-loop-end -->
    [/wpv-items-found]
    [wpv-no-items-found]        
    [/wpv-no-items-found]
[wpv-layout-end]
This support ticket is created 6 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Christian Cox 6 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#608482

i have a custom post called "classes" with taxonomy category named "class categories"
and a parent of "classes" called "rabbis" (means teachers)
I made a toolset wordpress archive for "classes categorie"taxonomy
and added a post relationship filter to "rabbis"
i got the result:
hidden link
saying :"Rabbis The ancestors argument does not end with a valid parent for the returned post types on this View."
What did i wrong?

#608628

This is a limitation of the WordPress Archive custom search feature, unfortunately. It's not possible to filter by post relationship in a term archive. We do not offer an API available to make modifications to a WordPress Archive query filter either, so I think the only way to accomplish this is to create a custom search View that filters by term and by post relationship. Pass the term in as a shortcode attribute like "wpvclasspostcategory", and use a URL parameter for the Post Relationship filter. Then place this View in your classes categorie WordPress Archive. You can use the wpv-taxonomy-archive shortcode to pass the current archive term slug into the filter like this:

[wpv-view name="classes-filtered-by-rabbis" wpvclasspostcategory="[wpv-taxonomy-archive info='name']"]
#608640

bsd

You mean to place my customed view in toolset wp archive?
in what part? (filter? display loop?)
and where to put the code [wpv-view name="classes-filtered-by-rabbis" wpvclasspostcategory="[wpv-taxonomy-archive info='name']"]
??
thanks

#608667

Place the custom View inside the WordPress Archive Loop Output area between wpv-layout-start and wpv-items-found. Leave the wpv-loop tag empty. Something like this:

[wpv-layout-start]
    [wpv-view name="classes-filtered-by-rabbis" wpvclasspostcategory="[wpv-taxonomy-archive info='name']"]
	[wpv-items-found]
	<!-- wpv-loop-start -->
                <wpv-loop>
                </wpv-loop>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]		
	[/wpv-no-items-found]
[wpv-layout-end]