Reply 320705 to: Search results on blog sidebar show blocks

Avatar: Niddy
Niddy
Participant
March 28, 2022 at 09:47

Hiya

See private info for working example of what I mean…..

Any thoughts on how to hide these….? It’s really urgent as we cannot go live with this huge error. Please urgently advise.

Regards hiding testimonials, do you think this would work as a function? And if so can we also edit to hide the email blocks?

===========================
add_action( ‘init’, ‘exclude_testimonials_from_search’, 99 );
function exclude_testimonials_from_search() {
global $wp_post_types;
if ( post_type_exists( ‘wpm-testimonial’ ) ) {
// exclude from search results
$wp_post_types[‘wpm-testimonial’]->exclude_from_search = true;
}
}
===========================

Or This – can hide testimonials etc but not the customizer emails… I have decided to install this instead of the snippet above because I can control all the other static blocks that are showing up –> https://wordpress.org/plugins/mpress-hide-from-search/

Please contact administrator
for this information.
Go To The Whole Conversation In Topic
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.