In the default category of my blog are shown the pages (post type: “page”) how is this possible?
Can someone give me a suggestion to solve this problem?
thanks a lot
Rodolfo
Hey Rikard ,
https://agenziamatrimonialefirenze.com/amore/
The first two are articles, the following are all random pages. The strange thing is that this error only occurs in the default category.
Best regards,
Foffo75
Hi Foffo75,
Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?
Best regards,
Victoria
Hi Vittoria, if you give me an email address I’ll send you access.
Best regards,
Foffo75
Hi Vittoria,
here are the credentials.
Best regards,
Foffo75
hey group!
no one who can help me?
thanks a lot
Hi,
I’m sorry for the late response. This filter should help exclude the pages post type from the archive pages.
function ava_exclude_pages( $query ) {
if ( is_admin() || ! $query->is_main_query() ) return;
if ( $query->is_archive() ) {
if ( array_key_exists( 'category', $query->tax_query->queried_terms ) ) {
$query->set('post_type','post');
}
}
}
add_action( 'pre_get_posts', 'ava_exclude_pages' );
Best regards,
Ismael
Hi ismael, meanwhile, thanks for the support. The filter where should be added precisely in archive.php? or in function.php?
Thanks again
Foffo75
Hi,
Please try it at the very bottom of your child theme functions.php file.
Best regards,
Rikard
Hi,
the filter works correctly only if I insert it in the mother thema. In the Child it does not work .
Best regards,
Foffo75