Skip to content

Instantly share code, notes, and snippets.

@msaari
Created October 15, 2020 04:29
Show Gist options
  • Save msaari/dd449ec4da5a9044e7962c766c802ed2 to your computer and use it in GitHub Desktop.
Save msaari/dd449ec4da5a9044e7962c766c802ed2 to your computer and use it in GitHub Desktop.
Block Formidable Forms entries
<?php
// Add this to theme functions.php and rebuild the index to remove Formidable Forms entries from index
add_filter( 'relevanssi_indexing_restriction', 'rlv_no_formidable' );
function rlv_no_formidable( $restriction ) {
global $wpdb;
$restriction['mysql'] .= " AND post.ID NOT IN (SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attached_file' AND meta_value LIKE 'formidable%' ) ";
$restriction['reason'] .= ' No Formidable Forms entries';
return $restriction;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment