Archived topic
remove action hooks
1 reply · Started by Heinrich on February 23, 2022
hi team,
we have following snippet in place:
add_action( 'generate_archive_title' , 'site_remove_archive_actions' , 0 );
function site_remove_archive_actions() {
if ( !is_post_type_archive( 'gastronomie' ) && !is_post_type_archive( 'verkaufsstelle' ) ) return false;
remove_action( 'generate_archive_title' , 'generate_archive_title' );
remove_action( 'generate_after_archive_title' , 'generate_do_archive_description' );
remove_action( 'generate_before_loop' , 'generate_do_search_results_title' );
remove_action( 'generate_after_entry_header', 'generate_post_image' );
remove_action( 'generate_after_do_template_part ' , 'generate_do_comments_template' );
remove_action( 'generate_after_loop' , 'generate_do_post_navigation' );
}
we created an element (hook - before main content) to show the content of metabox custom post-types.underneath this content we see a list of post titles we didn`t expect because of the remove action-hooks we set.
can you please have a look what we are doing wrong?
tks in advance
Hi Henrich,
To completely remove the archive listings from the archive page, you'll need to create an archive-cpt.php file for your CPT in your child theme folder, then remove the unwanted part from the file.